@@ -392,21 +392,27 @@ where
392392 return {
393393 ictx
394394 stx := newStx
395- diagnostics := old.diagnostics
395+ diagnostics := .empty
396+ metaSnap := .finished newStx {
397+ diagnostics := old.diagnostics
398+ }
396399 result? := some {
397400 parserState := newParserState
398- processedSnap := (← oldSuccess.processedSnap.bindIO (stx? := newStx)
401+ processedSnap := (← oldSuccess.processedSnap.bindIO
399402 (cancelTk? := none) (reportingRange? := progressRange?) (sync := true ) fun oldProcessed => do
400403 if let some oldProcSuccess := oldProcessed.result? then
401404 -- also wait on old command parse snapshot as parsing is cheap and may allow for
402405 -- elaboration reuse
403- oldProcSuccess.firstCmdSnap.bindIO (sync := true ) (stx? := newStx)
406+ oldProcSuccess.firstCmdSnap.bindIO (sync := true )
404407 (cancelTk? := none) (reportingRange? := progressRange?) fun oldCmd => do
405408 let prom ← IO.Promise.new
406409 let cancelTk ← IO.CancelToken.new
407410 parseCmd oldCmd newParserState oldProcSuccess.cmdState prom (sync := true ) cancelTk ctx
408- return .finished newStx {
409- diagnostics := oldProcessed.diagnostics
411+ return .finished none {
412+ diagnostics := .empty
413+ metaSnap := .finished newStx {
414+ diagnostics := oldProcessed.diagnostics
415+ }
410416 result? := some {
411417 cmdState := oldProcSuccess.cmdState
412418 firstCmdSnap := { stx? := none, task := prom.result!, cancelTk? := cancelTk } } }
@@ -425,13 +431,16 @@ where
425431 -- ...go immediately to next snapshot
426432 return (← unchanged old old.stx oldSuccess.parserState)
427433
428- withHeaderExceptions ({ · with ictx, stx := .missing, result? := none }) do
434+ withHeaderExceptions ({ · with ictx, stx := .missing, result? := none, metaSnap := default }) do
429435 -- parsing the header should be cheap enough to do synchronously
430436 let (stx, parserState, msgLog) ← Parser.parseHeader ictx
431437 if msgLog.hasErrors then
432438 return {
433439 ictx, stx
434- diagnostics := (← Snapshot.Diagnostics.ofMessageLog msgLog)
440+ diagnostics := .empty
441+ metaSnap := .finished stx {
442+ diagnostics := (← Snapshot.Diagnostics.ofMessageLog msgLog)
443+ }
435444 result? := none
436445 }
437446
@@ -452,7 +461,10 @@ where
452461 old.result?.forM (·.processedSnap.cancelRec)
453462 return {
454463 ictx, stx
455- diagnostics := (← Snapshot.Diagnostics.ofMessageLog msgLog)
464+ diagnostics := .empty
465+ metaSnap := .finished stx {
466+ diagnostics := (← Snapshot.Diagnostics.ofMessageLog msgLog)
467+ }
456468 result? := some {
457469 parserState
458470 processedSnap := (← processHeader ⟨trimmedStx⟩ parserState)
@@ -462,9 +474,9 @@ where
462474 processHeader (stx : HeaderSyntax) (parserState : Parser.ModuleParserState) :
463475 LeanProcessingM (SnapshotTask HeaderProcessedSnapshot) := do
464476 let ctx ← read
465- SnapshotTask.ofIO stx none (some ⟨0 , ctx.input.endPos⟩) <|
477+ SnapshotTask.ofIO none none (some ⟨0 , ctx.input.endPos⟩) <|
466478 ReaderT.run (r := ctx) <| -- re-enter reader in new task
467- withHeaderExceptions (α := HeaderProcessedSnapshot) ({ · with result? := none }) do
479+ withHeaderExceptions (α := HeaderProcessedSnapshot) ({ · with result? := none, metaSnap := default }) do
468480 let setup ← match (← setupImports stx) with
469481 | .ok setup => pure setup
470482 | .error snap => return snap
@@ -483,7 +495,7 @@ where
483495 let stopTime := (← IO.monoNanosNow).toFloat / 1000000000
484496 let diagnostics := (← Snapshot.Diagnostics.ofMessageLog msgLog)
485497 if msgLog.hasErrors then
486- return { diagnostics, result? := none }
498+ return { diagnostics, result? := none, metaSnap := default }
487499
488500 let mut traceState := default
489501 if trace.profiler.output.get? setup.opts |>.isSome then
@@ -521,8 +533,11 @@ where
521533 let cancelTk ← IO.CancelToken.new
522534 parseCmd none parserState cmdState prom (sync := true ) cancelTk ctx
523535 return {
524- diagnostics
525- infoTree? := cmdState.infoState.trees[0 ]!
536+ diagnostics := .empty
537+ metaSnap := .finished stx {
538+ diagnostics
539+ infoTree? := cmdState.infoState.trees[0 ]!
540+ }
526541 result? := some {
527542 cmdState
528543 firstCmdSnap := { stx? := none, task := prom.result!, cancelTk? := cancelTk }
0 commit comments