Closed
Description
In the following code the cast to Nothing does not throw the expected NullPointerException
def f: Unit = {
val a: Nothing = null.asInstanceOf[Nothing] // No exception
}
but it does in
def f: Unit = {
val a: Nothing = null.asInstanceOf[Nothing]
println(a) // throws here
}
def f: Unit = {
val a: Int = null.asInstanceOf[Nothing] // throws here
}
def f: Unit = {
null.asInstanceOf[Nothing] // throws here
}
This issue was metioned prevoiusly in #1002.