@@ -35,6 +35,7 @@ import scala.util.hashing.{ MurmurHash3 => hashing }
35
35
import config .Printers .{core , typr , matchTypes }
36
36
import reporting .{trace , Message }
37
37
import java .lang .ref .WeakReference
38
+ import compiletime .uninitialized
38
39
39
40
import scala .annotation .internal .sharable
40
41
import scala .annotation .threadUnsafe
@@ -4159,14 +4160,14 @@ object Types {
4159
4160
extends CachedProxyType with ValueType {
4160
4161
4161
4162
private var validSuper : Period = Nowhere
4162
- private var cachedSuper : Type = _
4163
+ private var cachedSuper : Type = uninitialized
4163
4164
4164
4165
// Boolean caches: 0 = uninitialized, -1 = false, 1 = true
4165
4166
private var myStableHash : Byte = 0
4166
4167
private var myGround : Byte = 0
4167
4168
4168
- private var myIsStablePeriod : Period = Nowhere
4169
- private var myIsStable : Boolean = false
4169
+ private var myisStableRunId : RunId = NoRunId
4170
+ private var myIsStable : Boolean = uninitialized
4170
4171
4171
4172
def isGround (acc : TypeAccumulator [Boolean ])(using Context ): Boolean =
4172
4173
if myGround == 0 then myGround = if acc.foldOver(true , this ) then 1 else - 1
@@ -4176,12 +4177,12 @@ object Types {
4176
4177
// We need to invalidate the cache when the period changes because the
4177
4178
// case `TermRef` of `Type#isStable` reads denotations, which depend on
4178
4179
// the period. See docs/_docs/internals/periods.md for more information.
4179
- if myIsStablePeriod != ctx.period then
4180
+ if myisStableRunId != ctx.runId then
4180
4181
val res : Boolean = computeIsStable
4181
4182
// We don't cache if the type is provisional because `Type#isStable`
4182
4183
// calls `Type#stripTypeVar` which might return different results later.
4183
4184
if ! isProvisional then
4184
- myIsStablePeriod = ctx.period
4185
+ myisStableRunId = ctx.runId
4185
4186
myIsStable = res
4186
4187
res
4187
4188
else
0 commit comments