@@ -347,6 +347,9 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
347
347
case OrType (tp21, tp22) =>
348
348
// Rewrite T1 <: (T211 & T212) | T22 to T1 <: (T211 | T22) and T1 <: (T212 | T22)
349
349
// and analogously for T1 <: T21 | (T221 & T222)
350
+ // `|' types to the right of <: are problematic, because
351
+ // we have to choose one constraint set or another, which might cut off
352
+ // solutions. The rewriting delays the point where we have to choose.
350
353
tp21 match {
351
354
case AndType (tp211, tp212) =>
352
355
return isSubType(tp1, OrType (tp211, tp22)) && isSubType(tp1, OrType (tp212, tp22))
@@ -460,6 +463,9 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
460
463
case AndType (tp11, tp12) =>
461
464
// Rewrite (T111 | T112) & T12 <: T2 to (T111 & T12) <: T2 and (T112 | T12) <: T2
462
465
// and analogously for T11 & (T121 | T122) & T12 <: T2
466
+ // `&' types to the left of <: are problematic, because
467
+ // we have to choose one constraint set or another, which might cut off
468
+ // solutions. The rewriting delays the point where we have to choose.
463
469
tp11 match {
464
470
case OrType (tp111, tp112) =>
465
471
return isSubType(AndType (tp111, tp12), tp2) && isSubType(AndType (tp112, tp12), tp2)
0 commit comments