Why does the following:
val x: Seq[Any] = Vector.empty
x match {
case Nil => 1
case _ => 2
}
where Vector.empty
internally equates to:
private[immutable] val NIL = new Vector[Nothing](0, 0, 0)
override def empty[A]: Vector[A] = NIL
match Nil
and return 1
? Isn't Nil
only a specific subtype of Seq
?
The answer remains the same if I use the more generic Seq.empty
. Why is that?