Skip to content

Commit 5bf3227

Browse files
committed
Also re-lub unions in widenUnionWithoutNull
1 parent 01e715d commit 5bf3227

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3598,12 +3598,11 @@ object Types extends TypeUtils {
35983598

35993599
override def widenUnionWithoutNull(using Context): Type =
36003600
if myUnionPeriod != ctx.period then
3601-
myUnion =
3602-
if isSoft then
3603-
TypeComparer.lub(tp1.widenUnionWithoutNull, tp2.widenUnionWithoutNull, canConstrain = true, isSoft = isSoft) match
3604-
case union: OrType => union.join
3605-
case res => res
3606-
else derivedOrType(tp1.widenUnionWithoutNull, tp2.widenUnionWithoutNull, soft = isSoft)
3601+
val union = TypeComparer.lub(
3602+
tp1.widenUnionWithoutNull, tp2.widenUnionWithoutNull, canConstrain = isSoft, isSoft = isSoft)
3603+
myUnion = union match
3604+
case union: OrType if isSoft => union.join
3605+
case _ => union
36073606
if !isProvisional then myUnionPeriod = ctx.period
36083607
myUnion
36093608

0 commit comments

Comments
 (0)