@@ -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 }
@@ -2408,7 +2408,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
24082408 * property that in all possible contexts, the same match type expression
24092409 * is either stuck or reduces to the same case.
24102410 */
2411- def provablyDisjoint (tp1 : Type , tp2 : Type )(using Context ): Boolean = {
2411+ def provablyDisjoint (tp1 : Type , tp2 : Type )(using Context ): Boolean = trace( i " provable disjoint $tp1 , $tp2 " , matchTypes) {
24122412 // println(s"provablyDisjoint(${tp1.show}, ${tp2.show})")
24132413
24142414 def isEnumValueOrModule (ref : TermRef ): Boolean =
@@ -2452,7 +2452,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
24522452 decompose(cls2, tp2).forall(x => provablyDisjoint(x, tp1))
24532453 else
24542454 false
2455- case (AppliedType (tycon1, args1), AppliedType (tycon2, args2)) if tycon1 == tycon2 =>
2455+ case (AppliedType (tycon1, args1), AppliedType (tycon2, args2))
2456+ if tycon1.typeSymbol == tycon2.typeSymbol && tycon1 =:= tycon2 =>
24562457 // It is possible to conclude that two types applies are disjoint by
24572458 // looking at covariant type parameters if the said type parameters
24582459 // are disjoin and correspond to fields.
@@ -2768,7 +2769,7 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
27682769 * None if the match fails and we should consider the following cases
27692770 * because scrutinee and pattern do not overlap
27702771 */
2771- def matchCase (cas : Type ): Option [Type ] = {
2772+ def matchCase (cas : Type ): Option [Type ] = trace( i " match case $cas vs $scrut " , matchTypes) {
27722773 val cas1 = cas match {
27732774 case cas : HKTypeLambda =>
27742775 caseLambda = constrained(cas)
0 commit comments