diff --git a/src/Lean/CoreM.lean b/src/Lean/CoreM.lean index b2dee8594f..53b4d06a3c 100644 --- a/src/Lean/CoreM.lean +++ b/src/Lean/CoreM.lean @@ -446,10 +446,6 @@ Note that the value of `ctx.initHeartbeats` is ignored and replaced with `IO.get @[inline] def CoreM.toIO' (x : CoreM α) (ctx : Context) (s : State) : IO α := (·.1) <$> x.toIO ctx s -/-- withIncRecDepth for a monad `m` such that `[MonadControlT CoreM n]`. -/ -protected def withIncRecDepth [Monad m] [MonadControlT CoreM m] (x : m α) : m α := - controlAt CoreM fun runInBase => withIncRecDepth (runInBase x) - /-- Throws an internal interrupt exception if cancellation has been requested. The exception is not caught by `try catch` but is intended to be caught by `Command.withLoggingExceptions` at the top @@ -464,6 +460,12 @@ heartbeat tracking (e.g. `SynthInstance`). if (← tk.isSet) then throwInterruptException +/-- withIncRecDepth for a monad `m` such that `[MonadControlT CoreM n]`. +Also checks for cancellation, so that recursive elaboration functions +(inferType, whnf, isDefEq, …) respond promptly to interrupt requests. -/ +protected def withIncRecDepth [Monad m] [MonadControlT CoreM m] (x : m α) : m α := + controlAt CoreM fun runInBase => do checkInterrupted; withIncRecDepth (runInBase x) + register_builtin_option debug.moduleNameAtTimeout : Bool := { defValue := true descr := "include module name in deterministic timeout error messages.\nRemark: we set this option to false to increase the stability of our test suite"