blob: 745334b1cd4e30b83d361bf31b9a90dc2de83cf8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
case class Cell[A](var x: A)
object Test {
def f1(x: Any) = x match { case y @ Cell(_) => y } // Inferred type is Cell[Any]
// def f2(x: Cell[_]) = x match { case y @ Cell(_) => y } // Inferred type is Cell[_]
// def f3[A](x: Cell[A]) = x match { case y @ Cell(_) => y } // Inferred type is Cell[A]
def main(args: Array[String]): Unit = {
// val x = new Cell(1)
// val y = f1(x)
// y.x = "abc"
// println(x.x + 1)
}
}
|