-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Dotty unnecessarily wraps arrays used in place of java repeated #3675
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
Comments
This can be implemented as an optimisation in |
Hi Allan, I'd like to work on it. -V |
Sure! The code you need to change is: https://github.com/lampepfl/dotty/blob/c515e7e6eb93bbfe491596c3d2cbe1672685ad60/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala#L94 |
abeln
pushed a commit
to abeln/dotty
that referenced
this issue
Jan 18, 2018
… varargs When eliminating varargs in a java method call, we need to convert Seqs into Arrays. However, if the object we're passing is already a wrapped array, we just need to unwrap it. Testing ======= Eliminating varargs in import java.nio.file._ class Test { def test(xs: Array[String]) = { val p4 = Paths.get("Hello", xs: _*) } } now gives val p4: java.nio.file.Path = java.nio.file.Paths.get("Hello", xs)
abeln
pushed a commit
to abeln/dotty
that referenced
this issue
Jan 18, 2018
… varargs When eliminating varargs in a java method call, we need to convert Seqs into Arrays. However, if the object we're passing is already a wrapped array, we just need to unwrap it. Testing ------- Eliminating varargs in ``` import java.nio.file._ class Test { def test(xs: Array[String]) = { val p4 = Paths.get("Hello", xs: _*) } } ``` now gives `val p4: java.nio.file.Path = java.nio.file.Paths.get("Hello", xs)`
allanrenucci
added a commit
that referenced
this issue
Jan 23, 2018
Fix #3675: don't unnecessarily wrap arrays when eliminating java varargs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The code above is compiled by Dotty to:
And scalac:
The text was updated successfully, but these errors were encountered: