Closed
Description
Compiler version
scala3-3.0.0-RC3
$ java -version
openjdk version "1.8.0_272"
OpenJDK Runtime Environment (build 1.8.0_272-b10)
OpenJDK 64-Bit Server VM (build 25.272-b10, mixed mode)
Minimized code
$ bin/scala
scala> val a: List[Any] = List(List(1,2), List(3,4))
val a: List[Any] = List(List(1, 2), List(3, 4))
scala> for(b <- a ; c <- b.asInstanceOf[List]) { println(c) }
^C
Output
the above code hangs forever with no output, and with zero CPU usage.
If i do the same cast in a separate val, i get the expected compilation error:
scala> for(b <- a) { val c = b.asInstanceOf[List] ; for(d <- c) { println(d) } }
1 |for(b <- a) { val c = b.asInstanceOf[List] ; for(d <- c) { println(d) } }
| ^
| Missing type parameter for List
scala>
Expectation
Compilation fails with "Missing parameter type ..." error