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
primitive arrays and varargs #3304
Comments
Imported From: https://issues.scala-lang.org/browse/SI-3304?orig=1 |
@dubochet said: Predef.augmentString("%d %d").format(Predef.genericWrapArray(
Array.apply(5, Predef.wrapIntArray(Array[Int]{10})).$$asInstanceOf[Array[java.lang.Object]]()
)); Which looks strange (why the wrapIntArray on the second argument only?) |
@paulp said:
Turns out that's because all the scala.Array primitive applies look like this: def apply(x: Int, xs: Int*): Array[Int] = { Presumably because otherwise all the overloads look the same after erasure. I propose that the thing it's trying to do, which doesn't work in the fashion it's trying: $$asInstanceOf[Array[java.lang.Object]] should exist as a method on WrappedArray with a name like "toBoxed". It would be plus or minus: def toBoxed: Array[AnyRef] = array map (_.asInstanceOf[AnyRef]) |
@paulp said: |
First example doesn't work, should I think. All the other variations do work.
The text was updated successfully, but these errors were encountered: