fix: append match_<idx> suffix only there is more than one alternative

This commit is contained in:
Leonardo de Moura 2020-11-03 10:53:47 -08:00
parent b9a2885e65
commit f28a7306f2

View file

@ -23,7 +23,8 @@ private def mkAuxiliaryMatchTermAux (parentTag : Name) (matchTac : Syntax) : Sta
pure alt
else if holeOrTacticSeq.isOfKind `Lean.Parser.Term.hole then
let s ← get
let holeName := mkIdentFrom holeOrTacticSeq (parentTag ++ (`match).appendIndexAfter s.nextIdx)
let tag := if alts.size > 1 then parentTag ++ (`match).appendIndexAfter s.nextIdx else parentTag
let holeName := mkIdentFrom holeOrTacticSeq tag
let newHole ← `(?$holeName:ident)
modify fun s => { s with nextIdx := s.nextIdx + 1}
pure $ alt.setArg 2 newHole