refactor: simplify AddConstAsyncResult.commitCheckEnv use (#9715)
Also gets rid of some artifical `blocked (untracked)` time
This commit is contained in:
parent
285d271505
commit
42e472ff3f
2 changed files with 8 additions and 12 deletions
|
|
@ -1236,13 +1236,8 @@ where
|
|||
let ctx ← CommandContextInfo.save
|
||||
infoPromise.resolve <| .context (.commandCtx ctx) <| .node info (← getInfoTrees)
|
||||
async.commitConst (← getEnv)
|
||||
let cancelTk ← IO.CancelToken.new
|
||||
let checkAct ← wrapAsyncAsSnapshot (desc := s!"finishing proof of {declId.declName}")
|
||||
(cancelTk? := cancelTk) fun _ => do profileitM Exception "elaboration" (← getOptions) do
|
||||
processDeriving #[header]
|
||||
async.commitCheckEnv (← getEnv)
|
||||
let checkTask ← BaseIO.mapTask (t := (← getEnv).checked) checkAct
|
||||
Core.logSnapshotTask { stx? := none, task := checkTask, cancelTk? := cancelTk }
|
||||
processDeriving #[header]
|
||||
async.commitCheckEnv (← getEnv)
|
||||
Core.logSnapshotTask { stx? := none, task := (← BaseIO.asTask (act ())), cancelTk? := cancelTk }
|
||||
applyAttributesAt declId.declName view.modifiers.attrs .afterTypeChecking
|
||||
applyAttributesAt declId.declName view.modifiers.attrs .afterCompilation
|
||||
|
|
|
|||
|
|
@ -1123,9 +1123,9 @@ def AddConstAsyncResult.commitConst (res : AddConstAsyncResult) (env : Environme
|
|||
|
||||
/--
|
||||
Assuming `Lean.addDecl` has been run for the constant to be added on the async environment branch,
|
||||
commits the full constant info from that call to the main environment, waits for the final kernel
|
||||
environment resulting from the `addDecl` call, and commits it to the main branch as well, unblocking
|
||||
kernel additions there. All `commitConst` preconditions apply.
|
||||
commits the full constant info from that call to the main environment, (asynchronously) waits for
|
||||
the final kernel environment resulting from the `addDecl` call, and commits it to the main branch as
|
||||
well, unblocking kernel additions there. All `commitConst` preconditions apply.
|
||||
-/
|
||||
def AddConstAsyncResult.commitCheckEnv (res : AddConstAsyncResult) (env : Environment) :
|
||||
IO Unit := do
|
||||
|
|
@ -1133,8 +1133,9 @@ def AddConstAsyncResult.commitCheckEnv (res : AddConstAsyncResult) (env : Enviro
|
|||
-- `info?`
|
||||
if !(← res.constPromise.isResolved) then
|
||||
res.commitConst env
|
||||
res.checkedEnvPromise.resolve env.checked.get
|
||||
res.allRealizationsPromise.resolve env.allRealizations.get
|
||||
BaseIO.chainTask (sync := true) env.checked fun checked => do
|
||||
res.checkedEnvPromise.resolve checked
|
||||
BaseIO.chainTask (sync := true) env.allRealizations res.allRealizationsPromise.resolve
|
||||
|
||||
/--
|
||||
Checks whether `findAsync?` would return a result.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue