I don’t understand why the following case doesn’t match. Null should be an instance of Any, but it doesn’t match. Can someone explain what is going on?
val x = (2, null)
x match {
case (i:Int, v:Any) => println("got tuple %s: %s".format(i, v))
case _ => println("catch all")
}
prints catch all
Thanks.
This is exactly as specified.
It’s interesting that so much relevance has been attributed to null being a member of Any. It’s a member of every type but AnyVal and Nothing.