@@ -35,6 +35,7 @@ import scala.util.hashing.{ MurmurHash3 => hashing }
3535import config .Printers .{core , typr , matchTypes }
3636import reporting .{trace , Message }
3737import java .lang .ref .WeakReference
38+ import compiletime .uninitialized
3839
3940import scala .annotation .internal .sharable
4041import scala .annotation .threadUnsafe
@@ -4159,14 +4160,14 @@ object Types {
41594160 extends CachedProxyType with ValueType {
41604161
41614162 private var validSuper : Period = Nowhere
4162- private var cachedSuper : Type = _
4163+ private var cachedSuper : Type = uninitialized
41634164
41644165 // Boolean caches: 0 = uninitialized, -1 = false, 1 = true
41654166 private var myStableHash : Byte = 0
41664167 private var myGround : Byte = 0
41674168
4168- private var myIsStablePeriod : Period = Nowhere
4169- private var myIsStable : Boolean = false
4169+ private var myisStableRunId : RunId = NoRunId
4170+ private var myIsStable : Boolean = uninitialized
41704171
41714172 def isGround (acc : TypeAccumulator [Boolean ])(using Context ): Boolean =
41724173 if myGround == 0 then myGround = if acc.foldOver(true , this ) then 1 else - 1
@@ -4176,12 +4177,12 @@ object Types {
41764177 // We need to invalidate the cache when the period changes because the
41774178 // case `TermRef` of `Type#isStable` reads denotations, which depend on
41784179 // the period. See docs/_docs/internals/periods.md for more information.
4179- if myIsStablePeriod != ctx.period then
4180+ if myisStableRunId != ctx.runId then
41804181 val res : Boolean = computeIsStable
41814182 // We don't cache if the type is provisional because `Type#isStable`
41824183 // calls `Type#stripTypeVar` which might return different results later.
41834184 if ! isProvisional then
4184- myIsStablePeriod = ctx.period
4185+ myisStableRunId = ctx.runId
41854186 myIsStable = res
41864187 res
41874188 else
0 commit comments