lean4-htt/tests/lean/run/caseTacInMacros.lean
Leonardo de Moura 2bc41d8f3a
fix: case tactic in macros (#4252)
We must erase macro scopes for tags in `case` as we do in `cases .. with
..` and `induction .. with ..`.
2024-05-23 00:01:24 +00:00

22 lines
463 B
Text

def f (n : Nat) := n + 1
macro "mymacro1 " h:ident : tactic =>
`(tactic| {
cases $h:ident with
| zero => decide
| succ => simp_arith [f]
})
example : f n > 0 := by
mymacro1 n -- works
macro "mymacro2 " h:ident : tactic =>
`(tactic| {
cases $h:ident
case zero => decide
case succ => simp_arith [f]
})
example : f n > 0 := by
-- Should **not** generate: Case tag 'zero._@.cases3._hyg.747' not found.
mymacro2 n