lean4-htt/tests/lean/precissues.lean
Leonardo de Moura 05e5d934d3 feat: change default precedence for new syntax
Now, the following example produces a syntax error.
```lean
macro "foo!" x:term : term => `($x + 1)

check id foo! 10
```

@Kha, I think the heuristic is simple and defensible.
If the new syntax starts and ends with token, than the precedence is
`maxPrec`. Otherwise, it is `leadPrec`.

see #180
2020-09-21 19:04:03 -07:00

41 lines
703 B
Text

new_frontend
#check id fun x => x -- should work
#check 0
def f (x : Nat) (g : Nat → Nat) := g x
#check f 1 fun x => x -- should fail
#check 0
#check f 1 (fun x => x)
#check id have True from ⟨⟩; this -- should fail
#check id let x := 10; x
#check 1
#check id (have True from ⟨⟩; this)
#check 0 = have Nat from 1; this
#check 0 = let x := 0; x
variables (p q r : Prop)
macro_rules `(¬ $p) => `(Not $p)
#check p ↔ ¬ q
#check True = ¬ False
#check p ∧ ¬q
#check ¬p ∧ q
#check ¬p ↔ q
#check ¬(p = q)
#check ¬ p = q
#check id ¬p
#check Nat → ∀ (a : Nat), a = a
macro "foo!" x:term : term => `($x + 1)
#check id foo! 10 -- error, `foo! x` precedence is leadPrec