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