Skip to content

Commit cb7fe9b

Browse files
committed
Don't let caseLambda bindings accumulate in constraint
Remove them when a `matchCases` has finished.
1 parent aadc10f commit cb7fe9b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2815,6 +2815,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
28152815
NoType
28162816

28172817
inFrozenConstraint {
2818+
val savedConstraint = constraint
28182819
// Empty types break the basic assumption that if a scrutinee and a
28192820
// pattern are disjoint it's OK to reduce passed that pattern. Indeed,
28202821
// empty types viewed as a set of value is always a subset of any other
@@ -2831,7 +2832,8 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
28312832
if (provablyEmpty(scrut))
28322833
NoType
28332834
else
2834-
recur(cases)
2835+
try recur(cases)
2836+
finally constraint = savedConstraint // caseLambda additions are dropped
28352837
}
28362838
}
28372839
}

0 commit comments

Comments
 (0)