lean4 icon indicating copy to clipboard operation
lean4 copied to clipboard

`elab_rules : tactic` patterns require redundant information

Open leodemoura opened this issue 2 years ago • 2 comments

import Lean

syntax "foo " str : tactic

open Lean Elab
elab_rules : tactic
  | `(foo $x:str) => logInfo x.getString

example : True := by
 foo "hello"  -- Error `tacticFoo_` has not been implemented

One has to write the elab_rules above as

elab_rules : tactic
  | `(tactic| foo $x:str) => logInfo x.getString

leodemoura avatar Jul 21 '22 21:07 leodemoura

I just ran into this as well. I think Tactic should be TSyntax `tactic -> TacticM Unit rather than Syntax -> TacticM Unit.

Vtec234 avatar Jul 22 '22 09:07 Vtec234

@Vtec234 It should, but in order to generate a type error here we would also have to fix Macro as mentioned in https://github.com/leanprover/lean4/pull/1251

Kha avatar Jul 22 '22 11:07 Kha