Ok, without checking, what do you think happens? (List(0): Seq[Int]) match { case _: List[Int] => 1 case _ => 2 }
-
-
Interesting: if I change the `0` into an `"a"` I get a fruitless type test compilation warning and `1` as output (using Scala 2.12.10). This is the expected result (due to erasure), but in both the original and the new case I would have expected a type erasure warning.
-
So I guess the compiler has enough information in this specific case to know that checking for a `List[Int]` makes sense and does not then issue the type erasure warning. Not sure if this is the subtlety you were talking about.
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.