Skip to content

Commit 7800d22

Browse files
committed
Refine cache validity check
1 parent ba0aff8 commit 7800d22

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3012,19 +3012,18 @@ object Types {
30123012

30133013
override def superType(implicit ctx: Context): Type = {
30143014
if (ctx.period != validSuper) {
3015-
var canCache = true
3015+
validSuper = ctx.period
30163016
cachedSuper = tycon match {
30173017
case tp: HKTypeLambda => defn.AnyType
30183018
case tp: TypeVar if !tp.inst.exists =>
30193019
// supertype not stable, since underlying might change
3020-
canCache = false
3020+
validSuper = Nowhere
30213021
tp.underlying.applyIfParameterized(args)
30223022
case tp: TypeProxy =>
3023-
canCache = !tp.typeSymbol.is(Provisional)
3023+
if (tp.typeSymbol.is(Provisional)) validSuper = Nowhere
30243024
tp.superType.applyIfParameterized(args)
30253025
case _ => defn.AnyType
30263026
}
3027-
if (canCache) validSuper = ctx.period
30283027
}
30293028
cachedSuper
30303029
}

0 commit comments

Comments
 (0)