@@ -2536,35 +2536,35 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2536
2536
*/
2537
2537
private def dropIfSuper (tp : Type , sub : Type ): Type =
2538
2538
2539
- def isSuperOf (sub : Type ): Boolean = sub match
2540
- case AndType (sub1, sub2) if isSuperOf(sub1) || isSuperOf(sub2) => true
2541
- case sub : TypeVar if sub.isInstantiated => isSuperOf(sub.instanceOpt)
2542
- case _ => isSubTypeWhenFrozen(sub, tp)
2539
+ // def isSuperOf(sub: Type): Boolean = sub match
2540
+ // case AndType(sub1, sub2) if isSuperOf(sub1) || isSuperOf(sub2) => true
2541
+ // case sub: TypeVar if sub.isInstantiated => isSuperOf(sub.instanceOpt)
2542
+ // case _ => isSubTypeWhenFrozen(sub, tp)
2543
2543
2544
2544
tp match
2545
2545
case tp @ AndType (tp1, tp2) =>
2546
2546
recombine(dropIfSuper(tp1, sub), dropIfSuper(tp2, sub), tp)
2547
2547
case tp : TypeVar if tp.isInstantiated =>
2548
2548
dropIfSuper(tp.instanceOpt, sub)
2549
2549
case _ =>
2550
- if isSuperOf (sub) then NoType else tp
2550
+ if isSubTypeWhenFrozen (sub, tp ) then NoType else tp
2551
2551
end dropIfSuper
2552
2552
2553
2553
/** If some (|-operand of) `tp` is a subtype of `sup` replace it with `NoType`. */
2554
2554
private def dropIfSub (tp : Type , sup : Type , canConstrain : Boolean ): Type =
2555
2555
2556
- def isSubOf (sup : Type ): Boolean = sup match
2557
- case OrType (sup1, sup2) if isSubOf(sup1) || isSubOf(sup2) => true
2558
- case sup : TypeVar if sup.isInstantiated => isSubOf(sup.instanceOpt)
2559
- case _ => isSubType(tp, sup, whenFrozen = ! canConstrain)
2556
+ // def isSubOf(sup: Type): Boolean = sup match
2557
+ // case OrType(sup1, sup2) if isSubOf(sup1) || isSubOf(sup2) => true
2558
+ // case sup: TypeVar if sup.isInstantiated => isSubOf(sup.instanceOpt)
2559
+ // case _ => isSubType(tp, sup, whenFrozen = !canConstrain)
2560
2560
2561
2561
tp match
2562
2562
case tp @ OrType (tp1, tp2) =>
2563
2563
recombine(dropIfSub(tp1, sup, canConstrain), dropIfSub(tp2, sup, canConstrain), tp)
2564
2564
case tp : TypeVar if tp.isInstantiated =>
2565
2565
dropIfSub(tp.instanceOpt, sup, canConstrain)
2566
2566
case _ =>
2567
- if isSubOf( sup) then NoType else tp
2567
+ if isSubType(tp, sup, whenFrozen = ! canConstrain ) then NoType else tp
2568
2568
end dropIfSub
2569
2569
2570
2570
/** There's a window of vulnerability between ElimByName and Erasure where some
0 commit comments