lean4-htt/tests/lean/run/issue3770.lean
Joachim Breitner 301dd7ba16
feat: failing macros to show error from first registered rule (#3771)
fixes #3770

Also start `rfl` with a `fail` message that is hopefully more helpful
than what we get now (see updated test output). This would be a cheaper
way to address #3302 without changing the implementation of rfl (as
tried in #3714).
2024-03-26 22:24:45 +00:00

23 lines
568 B
Text

macro "foo" : tactic => `(tactic|fail "first")
macro_rules | `(tactic|foo) => `(tactic|exact 1)
macro_rules | `(tactic|foo) => `(tactic|fail "middle")
macro_rules | `(tactic|foo) => `(tactic|exact 2)
macro_rules | `(tactic|foo) => `(tactic|fail "last")
def what_is_foo : Nat := by foo
/-- info: 2 -/
#guard_msgs in
#eval what_is_foo
macro "bar" : tactic => `(tactic|fail "first")
macro_rules | `(tactic|bar) => `(tactic|fail "middle")
macro_rules | `(tactic|bar) => `(tactic|fail "last")
/--
error: first
⊢ Nat
-/
#guard_msgs in
def what_is_bar : Nat := by bar