@@ -3510,8 +3510,9 @@ object Types extends TypeUtils {
35103510 myUnion
35113511
35123512 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
35153516
35163517 private def computeAtoms ()(using Context ): Atoms =
35173518 if tp1.hasClassSymbol(defn.NothingClass ) then tp2.atoms
@@ -3523,18 +3524,16 @@ object Types extends TypeUtils {
35233524 val tp2w = tp2.widenSingletons
35243525 if ((tp1 eq tp1w) && (tp2 eq tp2w)) this else TypeComparer .lub(tp1w, tp2w, isSoft = isSoft)
35253526
3526- private def ensureAtomsComputed ()( using Context ): Unit =
3527+ override def atoms ( using Context ): Atoms =
35273528 if atomsRunId != ctx.runId then
35283529 myAtoms = computeAtoms()
3529- myWidened = computeWidenSingletons()
35303530 if ! isProvisional then atomsRunId = ctx.runId
3531-
3532- override def atoms (using Context ): Atoms =
3533- ensureAtomsComputed()
35343531 myAtoms
35353532
35363533 override def widenSingletons (using Context ): Type =
3537- ensureAtomsComputed()
3534+ if widenedRunId != ctx.runId then
3535+ myWidened = computeWidenSingletons()
3536+ if ! isProvisional then widenedRunId = ctx.runId
35383537 myWidened
35393538
35403539 def derivedOrType (tp1 : Type , tp2 : Type , soft : Boolean = isSoft)(using Context ): Type =
0 commit comments