Skip to content

Commit e3355ca

Browse files
committed
Simplify code some more
1 parent 998ea84 commit e3355ca

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/Lean/Meta/Match/Match.lean

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -555,17 +555,10 @@ private def processConstructor (p : Problem) : MetaM (Array Problem) := do
555555
| _ => unreachable!
556556
return { mvarId := subgoal.mvarId, vars := newVars, alts := newAlts, examples := examples }
557557

558-
private def altsAreCtorLike (p : Problem) : MetaM Bool := withGoalOf p do
559-
pure (hasCtorPattern p) <&&>
560-
p.alts.allM fun alt => do match alt.patterns with
561-
| .ctor .. :: _ => return true
562-
| .inaccessible e :: _ => isConstructorApp e
563-
| _ => return false
564-
565558
private def processNonVariable (p : Problem) : MetaM Problem := withGoalOf p do
566559
let x :: xs := p.vars | unreachable!
567560
if let some (ctorVal, xArgs) ← withTransparency .default <| constructorApp'? x then
568-
if (← altsAreCtorLike p) then
561+
if hasCtorPattern p then
569562
let alts ← p.alts.filterMapM fun alt => do
570563
match alt.patterns with
571564
| .ctor ctorName _ _ fields :: ps =>
@@ -574,6 +567,7 @@ private def processNonVariable (p : Problem) : MetaM Problem := withGoalOf p do
574567
else
575568
return some { alt with patterns := fields ++ ps }
576569
| .inaccessible _ :: _ => processInaccessibleAsCtor alt ctorVal.name
570+
| .var _ :: _ => expandVarIntoCtor? alt ctorVal.name
577571
| _ => unreachable!
578572
let xFields := xArgs.extract ctorVal.numParams xArgs.size
579573
return { p with alts := alts, vars := xFields.toList ++ xs }

0 commit comments

Comments
 (0)