Skip to content

Commit d7b69a3

Browse files
Only set match type reduction context if not up to date
1 parent d1931aa commit d7b69a3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5124,6 +5124,7 @@ object Types extends TypeUtils {
51245124
}
51255125

51265126
def isUpToDate: Boolean =
5127+
(reductionContext ne null) &&
51275128
reductionContext.keysIterator.forall: tp =>
51285129
reductionContext(tp) `eq` contextInfo(tp)
51295130

@@ -5169,10 +5170,10 @@ object Types extends TypeUtils {
51695170
then
51705171
record("MatchType.reduce computed")
51715172
if (myReduced != null) record("MatchType.reduce cache miss")
5173+
if !isUpToDate then setReductionContext()
51725174
myReduced =
51735175
trace(i"reduce match type $this $hashCode", matchTypes, show = true):
51745176
withMode(Mode.Type):
5175-
setReductionContext()
51765177
TypeComparer.reduceMatchWith: cmp =>
51775178
val saved = ctx.typerState.snapshot()
51785179
try

0 commit comments

Comments
 (0)