blob: dd4ebf5139e8eea501f63ac80e07dda2a20a87d9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// scalac fails for test2/3
// dotc fails for all three
object test1 {
class Tree[-T >: Null]
def f(x: Any): Tree[Null] = x match {
case y: Tree[_] => y
}
}
object test2 {
class Tree[T >: Null]
def f(x: Any): Tree[Null] = x match {
case y: Tree[_] => y // error
}
}
object test3 {
class Tree[+T >: Null]
def f(x: Any): Tree[Null] = x match {
case y: Tree[_] => y // error
}
}
// Example contributed by Jason. I believe this should not typecheck,
// even though scalac does typecheck it.
object test4 {
class Base {
type N
class Tree[-S, -T >: Option[S]]
def g(x: Any): Tree[_, _ <: Option[N]] = x match {
case y: Tree[_, _] => y // error
}
}
}
class Test5 {
"": ({ type U = this.type })#U // error
}
|