Closed
Description
Observation
Consider the following code:
object MatchTest {
val a: Array[Long] = Array(1L)
def test(x: Any) = x match {
case Array(i: Long) => println("Success!")
case _ => println("Failure!") }
def main(args: Array[String]): Unit = test(a) }
When run under Scala 2.13.8 this produces Success
whereas under Scala 3.1.1 it produces Failure
. For the latter it does not matter if the compiler option -source:3.0-migration
is used.
Expectation
Same behaviour under both versions or (at least) a warning that the match will fail. Current situation significantly changes runtime behaviour after migrating projects from Scala 2 to Scala 3.