Skip to content

Commit 2f90b1d

Browse files
authored
fix: elaborate grind state filter (#10874)
This PR uses the correct context for elaborating the `grind` state filter.
1 parent 2991c66 commit 2f90b1d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Lean/Elab/Tactic/Grind/BuiltinTactic.lean

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ import Lean.Elab.Tactic.Grind.ShowState
2828
import Lean.Elab.SetOption
2929
namespace Lean.Elab.Tactic.Grind
3030

31-
def showStateAt (ref : Syntax) (filter : Filter) : GrindTacticM Unit := do
32-
if let goalBefore :: _ := (← getGoals) then
33-
withRef ref <| goalBefore.withContext <| showState filter (isSilent := true)
31+
def showStateAt (ref : Syntax) (filter? : Option (TSyntax `grind_filter)) : GrindTacticM Unit := do
32+
if let goal :: _ := (← getGoals) then
33+
withRef ref <| goal.withContext do
34+
let filter ← elabFilter filter?
35+
showState filter (isSilent := true)
3436
else
3537
logAt ref (severity := .information) (isSilent := true) "no grind state"
3638

@@ -40,10 +42,9 @@ def evalSepTactics (stx : Syntax) : GrindTacticM Unit := do
4042
match arg with
4143
| `(Parser.Tactic.Grind.grindStep| $tac:grind) => evalGrindTactic tac
4244
| `(Parser.Tactic.Grind.grindStep| $tac:grind | $[$filter?]?) =>
43-
let filter ← elabFilter filter?
44-
showStateAt arg filter
45+
showStateAt arg filter?
4546
evalGrindTactic tac
46-
showStateAt arg[1] filter
47+
showStateAt arg[1] filter?
4748
| _ => throwUnsupportedSyntax
4849
else
4950
saveTacticInfoForToken arg

0 commit comments

Comments
 (0)