-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #7212: Generate bridge for varargs annotation #9271
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
Conversation
e85808c
to
28df04e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you grep for @varargs
in https://github.com/scala/scala/tree/2.13.x/test you'll find a bunch of tests, can you try to port them over and see if they work with your implementation? One thing which probably still needs to be handled is when a scala method without @varargs
overrides a scala method with @varargs
, in that case we still need to generate the varargs bridge for the override I think.
Note that tests in |
I'll try that! |
e1304d6
to
8212750
Compare
I've ported some tests but this one fails because the generic signatures aren't properly generated. |
This TODO is probably related: https://github.com/lampepfl/dotty/blob/ffd6a5892740d8038e85e0302d56591241135652/compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala#L258 |
Yes the I've just tried this test and it fails under object VarArgs {
@annotation.varargs
def two(a: Int)(b: String*): Nothing = ???
}
I have yet to find the root cause of this. |
55cef3d
to
f6b0158
Compare
The ported tests seem to work now. I've added some cases. sconfig fails to build because it defines a |
No need hopefully: all the projects in our community build are submodules in https://github.com/dotty-staging, so we can fix them without waiting on upstream. I've just given you access to that organization, so you should be able to push a new branch to github.com/dotty-staging/scodec/ with the fix in, and update this PR to make the scodec submodule point to that commit. |
This was a hack for the lack of `@varargs` implementation, which is fixed by scala/scala3#9271
Done! SConfig was the only submodule not in dotty-staging so I forked it. |
7d508c6
to
06c0ef7
Compare
rebased |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work, thanks! That was harder than I thought it would be :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM!
This shares most of the logic with the generation of bridges for overrides of java varargs methods.
I've added tests inmoved to run/tests/i7212 after smarter's reviewpos-java-interop
, but I'm not 100% confident that this is the right place 🤔