File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 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
25862586 provablyDisjoint(tp1, gadtBounds(tp2.symbol).hi) || provablyDisjoint(tp1, tp2.superType)
25872587 case (tp1 : TermRef , tp2 : TermRef ) if isEnumValueOrModule(tp1) && isEnumValueOrModule(tp2) =>
25882588 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
25902591 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) ) =>
25922593 true
25932594 case (tp1 : Type , tp2 : Type ) if defn.isTupleType(tp1) =>
25942595 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