Skip to content

Commit

Permalink
Also re-lub unions in widenUnionWithoutNull
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Mar 26, 2024
1 parent 762815a commit 829adb7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3598,12 +3598,11 @@ object Types extends TypeUtils {

override def widenUnionWithoutNull(using Context): Type =
if myUnionPeriod != ctx.period then
myUnion =
if isSoft then
TypeComparer.lub(tp1.widenUnionWithoutNull, tp2.widenUnionWithoutNull, canConstrain = true, isSoft = isSoft) match
case union: OrType => union.join
case res => res
else derivedOrType(tp1.widenUnionWithoutNull, tp2.widenUnionWithoutNull, soft = isSoft)
val union = TypeComparer.lub(
tp1.widenUnionWithoutNull, tp2.widenUnionWithoutNull, canConstrain = isSoft, isSoft = isSoft)
myUnion = union match
case union: OrType if isSoft => union.join
case _ => union
if !isProvisional then myUnionPeriod = ctx.period
myUnion

Expand Down

0 comments on commit 829adb7

Please sign in to comment.