@@ -3510,8 +3510,9 @@ object Types extends TypeUtils {
3510
3510
myUnion
3511
3511
3512
3512
private var atomsRunId : RunId = NoRunId
3513
- private var myAtoms : Atoms = _
3514
- private var myWidened : Type = _
3513
+ private var widenedRunId : RunId = NoRunId
3514
+ private var myAtoms : Atoms = uninitialized
3515
+ private var myWidened : Type = uninitialized
3515
3516
3516
3517
private def computeAtoms ()(using Context ): Atoms =
3517
3518
if tp1.hasClassSymbol(defn.NothingClass ) then tp2.atoms
@@ -3523,18 +3524,16 @@ object Types extends TypeUtils {
3523
3524
val tp2w = tp2.widenSingletons
3524
3525
if ((tp1 eq tp1w) && (tp2 eq tp2w)) this else TypeComparer .lub(tp1w, tp2w, isSoft = isSoft)
3525
3526
3526
- private def ensureAtomsComputed ()( using Context ): Unit =
3527
+ override def atoms ( using Context ): Atoms =
3527
3528
if atomsRunId != ctx.runId then
3528
3529
myAtoms = computeAtoms()
3529
- myWidened = computeWidenSingletons()
3530
3530
if ! isProvisional then atomsRunId = ctx.runId
3531
-
3532
- override def atoms (using Context ): Atoms =
3533
- ensureAtomsComputed()
3534
3531
myAtoms
3535
3532
3536
3533
override def widenSingletons (using Context ): Type =
3537
- ensureAtomsComputed()
3534
+ if widenedRunId != ctx.runId then
3535
+ myWidened = computeWidenSingletons()
3536
+ if ! isProvisional then widenedRunId = ctx.runId
3538
3537
myWidened
3539
3538
3540
3539
def derivedOrType (tp1 : Type , tp2 : Type , soft : Boolean = isSoft)(using Context ): Type =
0 commit comments