fix: def+match macro

This commit is contained in:
Leonardo de Moura 2020-09-07 11:34:53 -07:00
parent a12bc273bb
commit 7809fe0b01
2 changed files with 9 additions and 1 deletions

View file

@ -126,7 +126,7 @@ private def declValToTerm (declVal : Syntax) : MacroM Syntax :=
if declVal.isOfKind `Lean.Parser.Command.declValSimple then
pure $ declVal.getArg 1
else if declVal.isOfKind `Lean.Parser.Command.declValEqns then
expandMatchAltsIntoMatch declVal (declVal.getArg 1)
expandMatchAltsIntoMatch declVal (declVal.getArg 0)
else
Macro.throwError declVal "unexpected definition value"

View file

@ -26,3 +26,11 @@ theorem ex3 {p q r : Prop} : p q → r → (q ∧ r) (p ∧ r) :=
by intro
| Or.inl hp, h => { apply Or.inr; apply And.intro; assumption; assumption }
| Or.inr hq, h => { apply Or.inl; exact ⟨hq, h⟩ }
inductive C
| mk₁ : Nat → C
| mk₂ : Nat → Nat → C
def C.x : C → Nat
| C.mk₁ x => x
| C.mk₂ x _ => x