File tree 2 files changed +17
-2
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -2586,9 +2586,10 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2586
2586
provablyDisjoint(tp1, gadtBounds(tp2.symbol).hi) || provablyDisjoint(tp1, tp2.superType)
2587
2587
case (tp1 : TermRef , tp2 : TermRef ) if isEnumValueOrModule(tp1) && isEnumValueOrModule(tp2) =>
2588
2588
tp1.termSymbol != tp2.termSymbol
2589
- case (tp1 : TermRef , tp2 : TypeRef ) if isEnumValueOrModule(tp1) && ! tp1.symbol.moduleClass.derivesFrom(tp2.classSymbol) =>
2589
+ case (tp1 : TermRef , tp2 : TypeRef ) if isEnumValueOrModule(tp1) && ! tp1.classSymbols.exists(_.derivesFrom(tp2.classSymbol)) =>
2590
+ // Note: enum values may have multiple parents
2590
2591
true
2591
- case (tp1 : TypeRef , tp2 : TermRef ) if isEnumValueOrModule(tp2) && ! tp2.symbol.moduleClass .derivesFrom(tp1.classSymbol) =>
2592
+ case (tp1 : TypeRef , tp2 : TermRef ) if isEnumValueOrModule(tp2) && ! tp2.classSymbols.exists(_ .derivesFrom(tp1.classSymbol) ) =>
2592
2593
true
2593
2594
case (tp1 : Type , tp2 : Type ) if defn.isTupleType(tp1) =>
2594
2595
provablyDisjoint(tp1.toNestedPairs, tp2)
Original file line number Diff line number Diff line change
1
+ trait SomeRestriction
2
+
3
+ enum ADT {
4
+ case A
5
+ case B extends ADT with SomeRestriction
6
+ }
7
+
8
+ object MinimalExample {
9
+ val b : ADT & SomeRestriction = ADT .B
10
+
11
+ b match {
12
+ case ADT .B => ???
13
+ }
14
+ }
You can’t perform that action at this time.
0 commit comments