lean4
lean4 copied to clipboard
Syyntax match does not put info on variables under repetitions
syntax "repro" (ident)? ident : command
example : Lean.Syntax → Option Lean.Syntax
| `(repro $[$x:ident]? a) => x
--^ textDocument/hover
| `(repro $[$x:ident]? b) => x
--^ textDocument/hover
--^ textDocument/definition
| _ => none
Only the x in the first match arm is highlighted like a variable. Furthermore, both x occurrences in the bodies jump to the x from the first match arm, which suggests that the binder for the second x is being misplaced on the syntax for the first one.
Also relevant: the issue only happens when the two variables are named the same. If the second identifier is named y, they are both highlighted independently and go to definition works as expected.