Skip to content

Commit

Permalink
fix: induction pre-tactic should be indented (#5494)
Browse files Browse the repository at this point in the history
Fixes #2876
  • Loading branch information
Kha authored Sep 27, 2024
1 parent 48711ce commit e7691f3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Init/Tactics.lean
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ syntax inductionAlt := ppDedent(ppLine) inductionAltLHS+ " => " (hole <|> synth
After `with`, there is an optional tactic that runs on all branches, and
then a list of alternatives.
-/
syntax inductionAlts := " with" (ppSpace tactic)? withPosition((colGe inductionAlt)+)
syntax inductionAlts := " with" (ppSpace colGt tactic)? withPosition((colGe inductionAlt)+)

/--
Assuming `x` is a variable in the local context with an inductive type,
Expand Down
5 changes: 5 additions & 0 deletions tests/lean/inductionParse.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/-! should not parse `done` as part of `induction` -/

example (a : Nat) : True := by
induction a with
done
1 change: 1 addition & 0 deletions tests/lean/inductionParse.lean.expected.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
inductionParse.lean:4:18-5:6: error: unexpected identifier; expected '|'
2 changes: 2 additions & 0 deletions tests/lean/run/inductionParse.lean
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/-! should not parse `case` as a `generalizing` variable -/

example (a b : Nat) : True := by
induction a generalizing b
case zero => trivial
Expand Down

0 comments on commit e7691f3

Please sign in to comment.