diff --git a/Pantograph/Goal.lean b/Pantograph/Goal.lean index fbc9f14..8dd09dd 100644 --- a/Pantograph/Goal.lean +++ b/Pantograph/Goal.lean @@ -136,8 +136,9 @@ protected def GoalState.withRootContext { n } [MonadControlT MetaM n] [Monad n] Meta.mapMetaM <| state.withContext' state.root private def restoreCoreMExtra (state : Core.SavedState) : CoreM Unit := + let { nextMacroScope, ngen, .. } := state modifyGetThe Core.State (fun st => ((), - { st with nextMacroScope := state.nextMacroScope, ngen := state.ngen })) + { st with nextMacroScope, ngen })) -- Restore the name generator and macro scopes of the core state protected def GoalState.restoreCoreMExtra (state: GoalState): CoreM Unit := restoreCoreMExtra state.coreState diff --git a/Test/Metavar.lean b/Test/Metavar.lean index 2da177a..19d6ecd 100644 --- a/Test/Metavar.lean +++ b/Test/Metavar.lean @@ -291,6 +291,7 @@ def test_replay_environment : TestM Unit := do pure type let .success state1 _ ← state.tryTacticM goal (Tactic.assignWithAuxLemma type) | fail "left" + state.restoreMetaM let goal := state.goals[1]! let type ← goal.withContext do let .ok type ← elabTerm (← `(term|(3: Nat) ≤ 5)) (.some $ .sort 0) | unreachable!