Skip to content

Commit

Permalink
fix: duplicate info trees from IO.processCommandsIncrementally (#5763)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kha authored Oct 18, 2024
1 parent a6243f6 commit 41b35ba
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Lean/Elab/Frontend.lean
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ partial def IO.processCommandsIncrementally (inputCtx : Parser.InputContext)
where
go initialSnap t commands :=
let snap := t.get
let commands := commands.push snap.data.stx
let commands := commands.push snap.data
if let some next := snap.nextCmdSnap? then
go initialSnap next.task commands
else
Expand All @@ -111,13 +111,15 @@ where
let messages := toSnapshotTree initialSnap
|>.getAll.map (·.diagnostics.msgLog)
|>.foldl (· ++ ·) {}
let trees := toSnapshotTree initialSnap
|>.getAll.map (·.infoTree?) |>.filterMap id |>.toPArray'
-- In contrast to messages, we should collect info trees only from the top-level command
-- snapshots as they subsume any info trees reported incrementally by their children.
let trees := commands.map (·.finishedSnap.get.infoTree?) |>.filterMap id |>.toPArray'
return {
commandState := { snap.data.finishedSnap.get.cmdState with messages, infoState.trees := trees }
parserState := snap.data.parserState
cmdPos := snap.data.parserState.pos
inputCtx, initialSnap, commands
commands := commands.map (·.stx)
inputCtx, initialSnap
}

def IO.processCommands (inputCtx : Parser.InputContext) (parserState : Parser.ModuleParserState)
Expand Down

0 comments on commit 41b35ba

Please sign in to comment.