Skip to content

Commit 44fa078

Browse files
committed
feat: throw error if anchor is provided, but it is not a grind only
1 parent c56f8b7 commit 44fa078

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ public def elabGrindParams (params : Grind.Params) (ps : TSyntaxArray ``Parser.T
161161
| `(Parser.Tactic.grindParam| ! $[$mod?:grindMod]? $id:ident) =>
162162
params ← processParam params p mod? id (minIndexable := true) (only := only)
163163
| `(Parser.Tactic.grindParam| #$anchor:hexnum) =>
164+
unless only do
165+
throwErrorAt anchor "invalid anchor, `only` modifier expected"
164166
params ← processAnchor params anchor
165167
| _ => throwError "unexpected `grind` parameter{indentD p}"
166168
catch ex =>

tests/lean/run/grind_finish_trace.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ example (f g : Int → Int) (x y z w : Int)
218218
g w ≠ z → f x = y := by
219219
fail_if_success grind [#23ad] -- not possible to solve using this set of anchors.
220220
set_option trace.grind.split true in
221-
grind [#23ad, #beb4] -- Only these two splits were performed.
221+
grind only [#23ad, #beb4] -- Only these two splits were performed.
222222

223223
/--
224224
trace: [grind.ematch.instance] h: f (f a) = f a
@@ -250,4 +250,4 @@ example (f g : Int → Int)
250250
(_ : g (g b) = b)
251251
: f (f (f a)) = f a := by
252252
set_option trace.grind.ematch.instance true in
253-
grind [#99cb]
253+
grind only [#99cb]

0 commit comments

Comments
 (0)