chore: reactivate tactic match and introMatch

This commit is contained in:
Leonardo de Moura 2020-12-22 07:13:54 -08:00
parent 403c4bbf47
commit 7d1e493531
3 changed files with 2 additions and 9 deletions

View file

@ -326,7 +326,7 @@ private def introStep (n : Name) : TacticM Unit :=
| `(tactic| intro _) => introStep `_
| `(tactic| intro $pat:term) => do
let m ← `(match h with | $pat:term => _)
let m := m.setKind ``Lean.Parser.Tactic.matchTemp
let m := m.setKind ``Lean.Parser.Tactic.match
let stxNew ← `(tactic| intro h; $m; clear h)
withMacroExpansion stx stxNew $ evalTactic stxNew
| `(tactic| intro $hs:term*) => do
@ -336,12 +336,10 @@ private def introStep (n : Name) : TacticM Unit :=
withMacroExpansion stx stxNew $ evalTactic stxNew
| _ => throwUnsupportedSyntax
/-
@[builtinTactic Lean.Parser.Tactic.introMatch] def evalIntroMatch : Tactic := fun stx => do
let matchAlts := stx[1]
let stxNew ← liftMacroM $ Term.expandMatchAltsIntoMatchTactic stx matchAlts
withMacroExpansion stx stxNew $ evalTactic stxNew
-/
private def getIntrosSize : Expr → Nat
| Expr.forallE _ _ b _ => getIntrosSize b + 1

View file

@ -43,7 +43,7 @@ private def mkAuxiliaryMatchTerm (parentTag : Name) (matchTac : Syntax) : MacroM
let (matchTerm, s) ← mkAuxiliaryMatchTermAux parentTag matchTac |>.run {}
pure (matchTerm, s.cases)
-- @[builtinTactic Lean.Parser.Tactic.match]
@[builtinTactic Lean.Parser.Tactic.match]
def evalMatch : Tactic := fun stx => do
let tag ← getMainTag
let (matchTerm, cases) ← liftMacroM $ mkAuxiliaryMatchTerm tag stx
@ -51,7 +51,4 @@ def evalMatch : Tactic := fun stx => do
let stxNew := mkNullNode (#[refineMatchTerm] ++ cases)
withMacroExpansion stx stxNew $ evalTactic stxNew
@[builtinTactic Lean.Parser.Tactic.matchTemp] def evalMatchTemp : Tactic :=
evalMatch
end Lean.Elab.Tactic

View file

@ -20,8 +20,6 @@ def matchAlts := Term.matchAlts (rhsParser := matchRhs)
@[builtinTacticParser] def «match» := parser!:leadPrec "match " >> sepBy1 Term.matchDiscr ", " >> Term.optType >> " with " >> matchAlts
@[builtinTacticParser] def introMatch := parser! nonReservedSymbol "intro " >> matchAlts
@[builtinTacticParser high] def «matchTemp» := parser!:leadPrec "match " >> sepBy1 Term.matchDiscr ", " >> Term.optType >> " with " >> matchAlts
end Tactic
end Parser
end Lean