Open
Description
The following code compiles and runs as expected:
val x : List[T] forSome { type T } = List(42)
val w = x match { case y : List[u] => ((z : u) => z)(y.head) }
but this slight variation does not:
val x : T forSome { type T } = 42
val w = x match { case y : u => ((z : u) => z)(y) }
It reports that it cannot find type u
. You get the same error with this variation:
val x : List[List[T]] forSome { type T } = List(List(42))
val w = x match { case y : List[List[u]] => ((z : u) => z)(y.head.head) }
But in this case, I can imagine that the problem can be attributed to erasure.