diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/pos/t9498.scala | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/files/pos/t9498.scala b/test/files/pos/t9498.scala new file mode 100644 index 0000000000..32fc01a806 --- /dev/null +++ b/test/files/pos/t9498.scala @@ -0,0 +1,25 @@ +trait Inv[A] { def head: A } +trait Cov[+A] { def head: A } + +class Test { + def inv(i: Inv[Inv[String]]) = i match { + case l: Inv[a] => + val x: a = l.head + x.head: String // okay + } + + def cov(c: Cov[Cov[String]]) = c match { + case l: Cov[a] => + val x: a = l.head + x.head: String // was: found A, required String + } + + def cov1(c: Cov[Cov[String]]) = c match { + case l: Cov[a] => l.head.head + } + cov1(null): String // was: found A, required String + + def cov3(c: Cov[Cov[String]]): String = c match { + case l: Cov[a] => val l1: l.type = l; l1.head.head + } +} |