Skip to content

Commit

Permalink
fix: do not ban .. with a . on the next line (#4768)
Browse files Browse the repository at this point in the history
Without this change,
```lean
example : True := by
  refine' trivial ..
  . trivial
```
is a parse error.
  • Loading branch information
eric-wieser authored Sep 17, 2024
1 parent 46b16b6 commit b74f85a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Lean/Parser/Term.lean
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ We use them to implement `macro_rules` and `elab_rules`
def namedArgument := leading_parser (withAnonymousAntiquot := false)
atomic ("(" >> ident >> " := ") >> withoutPosition termParser >> ")"
def ellipsis := leading_parser (withAnonymousAntiquot := false)
".." >> notFollowedBy "." "`.` immediately after `..`"
".." >> notFollowedBy (checkNoWsBefore >> ".") "`.` immediately after `..`"
def argument :=
checkWsBefore "expected space" >>
checkColGt "expected to be indented" >>
Expand Down
10 changes: 10 additions & 0 deletions tests/lean/run/4768.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/-!
Test that `..` tokens do not break nearby `.`s.
Note that this tests specifically for issues with `.` that are not present with `·`.
-/

example : True ∧ True := by
constructor
refine trivial ..
. trivial -- this has to be . not · for this test to be useful

0 comments on commit b74f85a

Please sign in to comment.