New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty WrappedArray.ofRef.array throws ClassCastException #9941
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9941?orig=1 |
Additional example(just hit this problem on my project): the following code
throws the main method decompiles to:
reproducible on 2.13: https://scastie.scala-lang.org/wvg8VYr2QNSa11r8WmIDFQ |
not fixed in Scala 3 (as of 3.3.2-RC1-bin-20230613-d83aa49-NIGHTLY) |
The improvement
but
|
.array
on an emptyWrappedArray$ofRef
throws aClassCastException
.Here is a simple example where calling
.array
on anArray
hits it via an implicit conversion fromArray
toWrappedArray$ofRef
:Here's the above implicit unrolled:
Other, primitive
WrappedArray
subclasses seem to not have the issue:I haven't fully pieced together exactly where/why the exception occurs, but it seems unexpected/buggy for
Array
to have an always-available (via an implicit).array
method that will throw such an inscrutable exception on empty Arrays.The text was updated successfully, but these errors were encountered: