Merge pull request 'fix: Reset core message log' (#144) from bug/core-state-error-linger into dev

Reviewed-on: #144
This commit is contained in:
Leni Aniva 2024-12-11 09:09:33 -08:00
commit f14a37897b
2 changed files with 3 additions and 1 deletions

View File

@ -244,12 +244,13 @@ protected def GoalState.tryTacticM (state: GoalState) (goal: MVarId) (tacticM: E
let nextState ← state.step goal tacticM guardMVarErrors
-- Check if error messages have been generated in the core.
let newMessages ← (← Core.getMessageLog).toList --.drop state.coreState.messages.toList.length
let newMessages ← (← Core.getMessageLog).toList.drop state.coreState.messages.toList.length
|>.filterMapM λ m => do
if m.severity == .error then
return .some $ ← m.toString
else
return .none
Core.resetMessageLog
if ¬ newMessages.isEmpty then
return .failure newMessages.toArray
return .success nextState

View File

@ -79,6 +79,7 @@ def execute (command: Protocol.Command): MainM Lean.Json := do
let state ← get
let nGoals := state.goalStates.size
set { state with nextId := 0, goalStates := .empty }
Lean.Core.resetMessageLog
return .ok { nGoals }
stat (_: Protocol.Stat): MainM (CR Protocol.StatResult) := do
let state ← get