lean4-htt/tests/lean/macroElabRulesIssue2.lean
Leonardo de Moura 3846dd60fd fix: evalTactic
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.
2022-07-19 23:28:14 -04:00

22 lines
489 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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`