Closed
Description
Compiler version
3.1.0
Minimized code
opaque type CovariantArray[+A] = Array[A]
object CovariantArray:
def crash() =
val stringArray: CovariantArray[String] = Array("foo", "bar")
val anyArray: CovariantArray[Any] = stringArray
anyArray(0) = 42
stringArray(0).length
CovariantArray.crash()
Output
java.lang.ArrayStoreException: java.lang.Integer
at Playground$CovariantArray$.crash(main.scala:9)
at Playground$.<clinit>(main.scala:12)
... 13 more
Expectation
Should not compile