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] {
1920
1920
sym.children.map(x => ctx.refineUsingParent(tp, x)).filter(_.exists)
1921
1921
1922
1922
(tp1.dealias, tp2.dealias) match {
1923
+ case (tp1 : TypeRef , tp2 : TypeRef ) if tp1.symbol == defn.SingletonClass || tp2.symbol == defn.SingletonClass =>
1924
+ true
1923
1925
case (tp1 : ConstantType , tp2 : ConstantType ) =>
1924
1926
tp1 == tp2
1925
1927
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
4
3
4
+ object Test1 {
5
5
trait Test {
6
6
type Type
7
+ // This is testing that both permutations of the types in a &
8
+ // are taken into account by the intersection test
7
9
val i : Bar [Y & Type ] = 1 // error
8
10
}
9
11
@@ -12,3 +14,35 @@ object G {
12
14
case Y => Int
13
15
}
14
16
}
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