Scala pattern matching confusion with Option[Any]
This is due to type-erasure. The JVM does not know of any type parameter, except on arrays. Because of that, Scala code can’t check whether an Option is an Option[Int] or an Option[String] — that information has been erased. You could fix your code this way, though: object Test { def test = { (Alice … Read more