Skip to content

Commit fc7ca99

Browse files
committed
widenUnion also widens singletoons and ExprTypes
1 parent 99a4fa6 commit fc7ca99

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ object Types {
10461046
* is approximated by constraining `A` to be =:= to `Int` and returning `ArrayBuffer[Int]`
10471047
* instead of `ArrayBuffer[_ >: Int | A <: Int & A]`
10481048
*/
1049-
def widenUnion(implicit ctx: Context): Type = this match {
1049+
def widenUnion(implicit ctx: Context): Type = widen match {
10501050
case OrType(tp1, tp2) =>
10511051
ctx.typeComparer.lub(tp1.widenUnion, tp2.widenUnion, canConstrain = true) match {
10521052
case union: OrType => union.join
@@ -1058,8 +1058,8 @@ object Types {
10581058
tp.derivedRefinedType(tp.parent.widenUnion, tp.refinedName, tp.refinedInfo)
10591059
case tp: RecType =>
10601060
tp.rebind(tp.parent.widenUnion)
1061-
case _ =>
1062-
this
1061+
case tp =>
1062+
tp
10631063
}
10641064

10651065
private def dealias1(keep: AnnotatedType => Context => Boolean)(implicit ctx: Context): Type = this match {

0 commit comments

Comments
 (0)