@@ -2475,9 +2475,12 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2475
2475
def provablyDisjoint (tp1 : Type , tp2 : Type )(using Context ): Boolean = trace(i " provable disjoint $tp1, $tp2" , matchTypes) {
2476
2476
// println(s"provablyDisjoint(${tp1.show}, ${tp2.show})")
2477
2477
2478
- def isEnumValueOrModule (ref : TermRef ): Boolean =
2478
+ def isEnumValue (ref : TermRef ): Boolean =
2479
2479
val sym = ref.termSymbol
2480
- sym.isAllOf(EnumCase , butNot= JavaDefined ) || sym.is(Module )
2480
+ sym.isAllOf(EnumCase , butNot= JavaDefined )
2481
+
2482
+ def isEnumValueOrModule (ref : TermRef ): Boolean =
2483
+ isEnumValue(ref) || ref.termSymbol.is(Module )
2481
2484
2482
2485
/** Can we enumerate all instantiations of this type? */
2483
2486
def isClosedSum (tp : Symbol ): Boolean =
@@ -2586,6 +2589,10 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2586
2589
provablyDisjoint(tp1, gadtBounds(tp2.symbol).hi) || provablyDisjoint(tp1, tp2.superType)
2587
2590
case (tp1 : TermRef , tp2 : TermRef ) if isEnumValueOrModule(tp1) && isEnumValueOrModule(tp2) =>
2588
2591
tp1.termSymbol != tp2.termSymbol
2592
+ case (tp1 : TermRef , _) if isEnumValue(tp1) =>
2593
+ false
2594
+ case (_, tp2 : TermRef ) if isEnumValue(tp2) =>
2595
+ false
2589
2596
case (tp1 : Type , tp2 : Type ) if defn.isTupleType(tp1) =>
2590
2597
provablyDisjoint(tp1.toNestedPairs, tp2)
2591
2598
case (tp1 : Type , tp2 : Type ) if defn.isTupleType(tp2) =>
0 commit comments