File tree Expand file tree Collapse file tree 2 files changed +39
-3
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -1920,6 +1920,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] {
19201920 sym.children.map(x => ctx.refineUsingParent(tp, x)).filter(_.exists)
19211921
19221922 (tp1.dealias, tp2.dealias) match {
1923+ case (tp1 : TypeRef , tp2 : TypeRef ) if tp1.symbol == defn.SingletonClass || tp2.symbol == defn.SingletonClass =>
1924+ true
19231925 case (tp1 : ConstantType , tp2 : ConstantType ) =>
19241926 tp1 == tp2
19251927 case (tp1 : TypeRef , tp2 : TypeRef ) if tp1.symbol.isClass && tp2.symbol.isClass =>
Original file line number Diff line number Diff line change 1- object G {
2- final class X
3- final class Y
1+ final class X
2+ final class Y
43
4+ object Test1 {
55 trait Test {
66 type Type
7+ // This is testing that both permutations of the types in a &
8+ // are taken into account by the intersection test
79 val i : Bar [Y & Type ] = 1 // error
810 }
911
@@ -12,3 +14,35 @@ object G {
1214 case Y => Int
1315 }
1416}
17+
18+ object Test2 {
19+ trait Wizzle [L <: Int with Singleton ] {
20+ type Bar [A ] = A match {
21+ case 0 => String
22+ case L => Int
23+ }
24+
25+ // This is testing that we don't make wrong assumptions about Singleton
26+ def right (fa : Bar [L ]): Int = fa // error
27+ }
28+
29+ trait Wazzlo [L <: Int with AnyVal ] {
30+ type Bar [A ] = A match {
31+ case 0 => String
32+ case L => Int
33+ }
34+
35+ // This is testing that we don't make wrong assumptions about AnyVal
36+ def right (fa : Bar [L ]): Int = fa // error
37+ }
38+
39+ trait Wuzzlu [L <: String with AnyRef ] {
40+ type Bar [A ] = A match {
41+ case " " => String
42+ case L => Int
43+ }
44+
45+ // This is testing that we don't make wrong assumptions about AnyRef
46+ def right (fa : Bar [L ]): Int = fa // error
47+ }
48+ }
You can’t perform that action at this time.
0 commit comments