-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Don't expand the name of accessors #9703
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
7145a91
to
3c0d04b
Compare
for
|
Yes, it looks like it's needed in |
No, I just went too far and removed the call to expand accessed symbols as well. |
Here's the bytecode diff for the standard library: https://gist.github.com/lrytz/49a317a85e3372fa4fdce69f9bf215e6. There are a few getters and setters that are no longer mangled, but all of them are, and remain, private (in bytecode). The reason for these changes: before this PR, calling What's not correct (and causing the bug) is the assumption that a private accessor implies a private getter/setter. When some transformation calls I guess the original intent was to keep consistency between getter/setter/field names. Worth noting that the consistency was only in the names, not in the flags; So overall, it's a risky area to touch, but I think there's a chance that we can do the change. |
Nice 👍 How can I produce such a diff for future reference?
Very good analysis
Small correction. The cause of the bug is
Good point 🤔
Yes, I'm not sure it was intentional to even expand related names.
I think it can be removed but results in a bigger diff to the existing tests (e.g. we get completions in the presentation compiler of |
I use https://github.com/dwijnand/scala-runners and https://github.com/scala/jardiff, then
Sure, if you have it already? |
Hmm, now serialization stability failed 🤔 |
Ah serialization...
This class has field So we cannot do the change for field names. Can you add that as a comment to the source code? |
I couldn't find a single use case where this is needed. The callee is usually either not an accessor at all or all declarations in scope are looped over and expanded. On the other hand this fixes a bug in specialization. After all the accessor(s) could be implementing an abstract method.
LGTM, but I'd also like to have a second opinion here. I update my comment above #9703 (comment); @retronym could you take a look? A slightly more conservative change would be this, but I think the current change is safe and clener.
|
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.
Oh wow didn't know about that. We could use it in many cases, also in Scala 3 👍 |
I couldn't find a single use case where this is needed.
The callee is usually either not an accessor at all
or all declarations in scope are looped over and expanded.
On the other hand this fixes a bug in specialization.
After all the accessor(s) could be implementing an abstract method.
The usual concerns about binary compatibility and specialization apply.
Fixes scala/bug#12222