@@ -11,7 +11,7 @@ import collection.mutable
1111import util .Stats
1212import config .Config
1313import config .Feature .migrateTo3
14- import config .Printers .{constr , subtyping , gadts , noPrinter }
14+ import config .Printers .{constr , subtyping , gadts , matchTypes , noPrinter }
1515import TypeErasure .{erasedLub , erasedGlb }
1616import TypeApplications ._
1717import Variances .{Variance , variancesConform }
@@ -2406,7 +2406,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
24062406 * property that in all possible contexts, the same match type expression
24072407 * is either stuck or reduces to the same case.
24082408 */
2409- def provablyDisjoint (tp1 : Type , tp2 : Type )(using Context ): Boolean = {
2409+ def provablyDisjoint (tp1 : Type , tp2 : Type )(using Context ): Boolean = trace( i " provable disjoint $tp1 , $tp2 " , matchTypes) {
24102410 // println(s"provablyDisjoint(${tp1.show}, ${tp2.show})")
24112411
24122412 def isEnumValueOrModule (ref : TermRef ): Boolean =
@@ -2450,7 +2450,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
24502450 decompose(cls2, tp2).forall(x => provablyDisjoint(x, tp1))
24512451 else
24522452 false
2453- case (AppliedType (tycon1, args1), AppliedType (tycon2, args2)) if tycon1 == tycon2 =>
2453+ case (AppliedType (tycon1, args1), AppliedType (tycon2, args2))
2454+ if tycon1.typeSymbol == tycon2.typeSymbol && tycon1 =:= tycon2 =>
24542455 // It is possible to conclude that two types applies are disjoint by
24552456 // looking at covariant type parameters if the said type parameters
24562457 // are disjoin and correspond to fields.
@@ -2766,7 +2767,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
27662767 * None if the match fails and we should consider the following cases
27672768 * because scrutinee and pattern do not overlap
27682769 */
2769- def matchCase (cas : Type ): Option [Type ] = {
2770+ def matchCase (cas : Type ): Option [Type ] = trace( i " match case $cas vs $scrut " , matchTypes) {
27702771 val cas1 = cas match {
27712772 case cas : HKTypeLambda =>
27722773 caseLambda = constrained(cas)
0 commit comments