lean4-htt/tests/lean/run/macroid.lean
Leonardo de Moura bdb9f4c86e feat: allow raw identifiers to be used where terms are expected
@Kha this commit fix another example of weird error message I have
experienced in the last few days.

The macro
```lean
syntax "case!" ident ":" term "with" term "," term : term
macro_rules
| `(case! $h : $cond with $t, $e) =>
  `((fun $h => cond $h $t $e) $cond)
```
is accepted, but as in `fun` binders, we get a weird error when
trying to elaborate an instance of the macro.
Example:
```lean
check case! h : 0 == 0 with h, not h
```
2020-01-25 14:55:32 -08:00

13 lines
305 B
Text

new_frontend
syntax "[" ident "↦" term "]" : term
macro_rules
| `([$x ↦ $v]) => `(fun $x => $v)
#check [x ↦ x + 1]
syntax "case!" ident ":" term "with" term "," term : term
macro_rules
| `(case! $h : $cond with $t, $e) => `((fun $h => cond $h $t $e) $cond)
#check case! h : 0 == 0 with h, not h