You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scala>vala:IArray[Int] =IArray(2)
vala:IArray[Int] =Array(2)
scala>valb:IArray[Any] = a
valb:IArray[Any] =Array(2)
scala> b.toArray
java.lang.ClassCastException: [I cannot be cast to [Ljava.lang.Object;
xuwei-k
changed the title
IArray.toArray is potentially unsafe (ArrayStoreException)
IArray.toArray is potentially unsafe (ArrayStoreException, ClassCastException)
May 25, 2021
Compiler version
3.0.0
Minimized code
Output
Expectation
b.toArray
should returnArray[Option[?]]
instead ofArray[Some[?]]
? 🤔Is this by design or bug 🤔
https://github.com/lampepfl/dotty/blob/release-3.0.0/library/src/scala/IArray.scala#L252-L254
The text was updated successfully, but these errors were encountered: