blob: 7e88585ae7eb7a8984ca6eae4ead59815786602e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
|
module test {
class List[a] {
def ::(x: a): List[a] = 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];
def cons[a](x: a, xs: List[a]): List[a] = null;
val x: List[Int] = Nil.::(1);
val y: List[Int] = nil.::(1);
}
|