This commit fixes bug reported by Patrick Massot. It happened when using `macro_rules` and `elab_rules` for the same `SyntaxNodeKind`. It also fixes missing error messages when there is more than one elaboration functions and there is `abortTactic` exception. Remark: this commit also changes the evaluation order. Macros are now tried before elaboration rules. The motivation is that macros are already applied before elaboration functions in the term elaborator.
22 lines
489 B
Text
22 lines
489 B
Text
import Lean
|
||
open Lean Elab
|
||
|
||
declare_syntax_cat fixDecl
|
||
syntax ident : fixDecl
|
||
syntax ident "<" term : fixDecl
|
||
|
||
syntax "Fix₁ " fixDecl : tactic
|
||
|
||
elab_rules : tactic
|
||
| `(tactic| Fix₁ $x:ident) => logInfo "simple"
|
||
|
||
elab_rules : tactic
|
||
| `(tactic| Fix₁ $x:ident < $bound:term) =>
|
||
throwError "Failed at elab_rules"
|
||
|
||
macro_rules
|
||
| `(ℕ) => `(Nat)
|
||
|
||
example : ∀ b : ℕ, ∀ a : Nat, a ≥ 2 → a / a = 1 := by
|
||
Fix₁ b
|
||
Fix₁ a < 2 -- should produce `Failed at elab_rules`
|