@@ -3423,25 +3423,29 @@ object Types {
3423
3423
private var myAtoms : Atoms = _
3424
3424
private var myWidened : Type = _
3425
3425
3426
+ private def computeAtoms ()(using Context ): Atoms =
3427
+ if tp1.hasClassSymbol(defn.NothingClass ) then tp2.atoms
3428
+ else if tp2.hasClassSymbol(defn.NothingClass ) then tp1.atoms
3429
+ else tp1.atoms | tp2.atoms
3430
+
3431
+ private def computeWidenSingletons ()(using Context ): Type =
3432
+ val tp1w = tp1.widenSingletons
3433
+ val tp2w = tp2.widenSingletons
3434
+ if ((tp1 eq tp1w) && (tp2 eq tp2w)) this else TypeComparer .lub(tp1w, tp2w, isSoft = isSoft)
3435
+
3426
3436
private def ensureAtomsComputed ()(using Context ): Unit =
3427
- if atomsRunId != ctx.runId then
3428
- myAtoms =
3429
- if tp1.hasClassSymbol(defn.NothingClass ) then tp2.atoms
3430
- else if tp2.hasClassSymbol(defn.NothingClass ) then tp1.atoms
3431
- else tp1.atoms | tp2.atoms
3432
- val tp1w = tp1.widenSingletons
3433
- val tp2w = tp2.widenSingletons
3434
- myWidened = if ((tp1 eq tp1w) && (tp2 eq tp2w)) this else TypeComparer .lub(tp1w, tp2w, isSoft = isSoft)
3437
+ if atomsRunId != ctx.runId && ! isProvisional then
3438
+ myAtoms = computeAtoms()
3439
+ myWidened = computeWidenSingletons()
3435
3440
atomsRunId = ctx.runId
3436
3441
3437
3442
override def atoms (using Context ): Atoms =
3438
3443
ensureAtomsComputed()
3439
- myAtoms
3444
+ if isProvisional then computeAtoms() else myAtoms
3440
3445
3441
- override def widenSingletons (using Context ): Type = {
3446
+ override def widenSingletons (using Context ): Type =
3442
3447
ensureAtomsComputed()
3443
- myWidened
3444
- }
3448
+ if isProvisional then computeWidenSingletons() else myWidened
3445
3449
3446
3450
def derivedOrType (tp1 : Type , tp2 : Type , soft : Boolean = isSoft)(using Context ): Type =
3447
3451
if ((tp1 eq this .tp1) && (tp2 eq this .tp2) && soft == isSoft) this
0 commit comments