@@ -1983,8 +1983,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
1983
1983
/** Merge `t1` into `tp2` if t1 is a subtype of some &-summand of tp2.
1984
1984
*/
1985
1985
private def mergeIfSub (tp1 : Type , tp2 : Type ): Type =
1986
- if (isSubTypeWhenFrozen(tp1, tp2))
1987
- if (isSubTypeWhenFrozen(tp2, tp1)) tp2 else tp1 // keep existing type if possible
1986
+ if (isSubTypeWhenFrozen(tp1, tp2)) tp1
1988
1987
else tp2 match {
1989
1988
case tp2 @ AndType (tp21, tp22) =>
1990
1989
val lower1 = mergeIfSub(tp1, tp21)
@@ -2004,8 +2003,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
2004
2003
* @param canConstrain If true, new constraints might be added to make the merge possible.
2005
2004
*/
2006
2005
private def mergeIfSuper (tp1 : Type , tp2 : Type , canConstrain : Boolean ): Type =
2007
- if (isSubType(tp2, tp1, whenFrozen = ! canConstrain))
2008
- if (isSubType(tp1, tp2, whenFrozen = ! canConstrain)) tp2 else tp1 // keep existing type if possible
2006
+ if (isSubType(tp2, tp1, whenFrozen = ! canConstrain)) tp1
2009
2007
else tp2 match {
2010
2008
case tp2 @ OrType (tp21, tp22) =>
2011
2009
val higher1 = mergeIfSuper(tp1, tp21, canConstrain)
0 commit comments