diff options
Diffstat (limited to 'test/pos/infer.scala')
-rw-r--r-- | test/pos/infer.scala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/pos/infer.scala b/test/pos/infer.scala index 7e88585ae7..7ff49ff70f 100644 --- a/test/pos/infer.scala +++ b/test/pos/infer.scala @@ -1,10 +1,10 @@ module test { - class List[a] { - def ::(x: a): List[a] = new Cons(x, this); + class List[+a] { + def ::[b >: a](x: b): List[b] = new Cons(x, this); } - case class Cons[a](x: a, xs: List[a]) extends List[a]; - case class Nil[a] extends List[a]; - def nil[a]: Nil[a] = new Nil[a]; + case class Cons[a, b <: a](x: a, xs: List[b]) extends List[a]; + case object Nil extends List[All]; + def nil[a]: List[a] = Nil; def cons[a](x: a, xs: List[a]): List[a] = null; val x: List[Int] = Nil.::(1); val y: List[Int] = nil.::(1); |