-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Wrong overload resolution: picks Any over Long with an Int argument #7630
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
I believe this is a consequence that weak conformance is gone. In Dotty an
I get the same output for both scalac and dotc:
|
Since I guess we do not want to bring weak conformance back, I see no way to fix this. Close? |
Can it not be fixed directly in overload resolution? If not fixed, we risk breaking quite a lot of testing code using JUnit, with runtime assertions. That's not a good migration story. :( |
Yeah, isn't Scala overloading resolution supposed to always match Java ? |
There's no such requirement. But we try to come close, for compatibility's sake. So, we'd have to bring weak conformance back? That would be unfortunate. |
Fix #7630: Use weak conformance in overloading resolution
minimized code
observed behavior
The first overload, taking
Any
s, is selected over the second one.expectation
Like in Scala 2, the second overload, taking
Long
s, should be selected, so that it prints:note
The API of
Asserts
above is defined in JUnit; it cannot be changed.workaround
We can work around the issue by making sure that both arguments truly are
Long
s:The text was updated successfully, but these errors were encountered: