fix: trailing whitespace in location formatter (#3318)

This causes problems when used in conjunction with `#guard_msgs` (which
checks whitespace) and trailing whitespace removal. Discovered by
@PatrickMassot in verbose-lean4.
This commit is contained in:
Mario Carneiro 2024-02-13 07:53:29 -08:00 committed by GitHub
parent 50d661610d
commit 56d703db8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 2 deletions

View file

@ -398,7 +398,7 @@ syntax locationWildcard := " *"
A hypothesis location specification consists of 1 or more hypothesis references
and optionally `⊢` denoting the goal.
-/
syntax locationHyp := (ppSpace colGt term:max)+ ppSpace patternIgnore( atomic("|" noWs "-") <|> "⊢")?
syntax locationHyp := (ppSpace colGt term:max)+ patternIgnore(ppSpace (atomic("|" noWs "-") <|> "⊢"))?
/--
Location specifications are used by many tactics that can operate on either the

View file

@ -63,3 +63,5 @@ def foo : a b c d e f g a b c d e f g h where
#eval fmt `(calc
1 = 1 := rfl
1 = 1 := rfl)
#eval fmt `(by rw [] at h)

View file

@ -70,3 +70,4 @@ def foo✝ : a✝ b✝ c✝ d✝ e✝ f✝ g✝ a✝ b✝ c✝ d✝ e✝ f✝ g
calc
1 = 1 := rfl✝
1 = 1 := rfl✝
by rw [] at h✝

View file

@ -65,7 +65,7 @@ Try this: simp only [bla, h] at *
| Sum.inl (y, z) => y + z
| Sum.inr val => 0
[Meta.Tactic.simp.rewrite] unfold h, h x ==> Sum.inl (x, x)
Try this: simp only [bla, h] at h'
Try this: simp only [bla, h] at h'
[Meta.Tactic.simp.rewrite] unfold bla, bla x ==> match h x with
| Sum.inl (y, z) => y + z
| Sum.inr val => 0