-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #9772: Normalize value definitions #9836
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
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.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Have an awesome day! ☀️
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.
Thank you for opening this pull request, however I think this needs more consideration, for example, it is illegal to define object extension_foo
, which suggests that val
definitions should also be covered by this check, or else it is a bug for objects to cause this error.
What do you think @smarter?
This pull request should probably also check the name of the generated setter, e.g. as shown in #9926 |
conflicts also need to be resolved. @tudorv91 are you able to look at this? |
@bishabosha sure I'll have a look |
139ab3e
to
305e5b7
Compare
@bishabosha Implemented the |
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.
looks pretty good, thank you, I have a few suggestions
21c8e26
to
76e4ef2
Compare
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
&& (!mods.is(Private) || ctx.owner.is(Trait) || ctx.owner.isPackageObject) | ||
if (setterNeeded) { | ||
|
||
val valName = normalizeName(vdef, tpt).asTermName |
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.
perhaps isSetterNeeded
could be a default parameter for normalizeName
to avoid calling it twice, and then swap the conditions in the Valdef branch (case vdef: ValDef if isSetterNeeded && name.isExtension
), but if the performance isn't impacted that much this is minor
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.
Yes, I considered that as well, but decided against it in order not to particularize the arg list of normalizeName
with a param that is relevant to one branch. The second call would happen only if the valDef
's name is extension
, so I would expect it to be highly exceptional
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.
Thank you for taking this on, I think this looks good.
.jvmopts
Outdated
@@ -1,4 +1,6 @@ | |||
-Xss1m | |||
-Xms512m | |||
-Xmx1200m | |||
-Xmx4096m |
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.
also are the changes to this file necessary?
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.
Hmm, strange that it appears as a diff. This is what's on master
, no?
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.
Rebased against the upstream and it's fine now
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/9836/ to see the changes. Benchmarks is based on merging with master (68a7c03) |
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/9836/ to see the changes. Benchmarks is based on merging with master (68a7c03) |
pretty strange error in the CI for test_bootstrapped:
|
This is likely fixed by sbt/zinc#915 |
would make sense seeing as this suddenly happened after .jvmops stack size and heap were reset to master branch |
* Restrict names for mutable values which lead to setter generation during desugaring
* Make `extension` variable names illegal * Fix scala#9772: Disallow `extension_` for immutable values
Co-authored-by: Jamie Thompson <bishbashboshjt@gmail.com>
Co-authored-by: Jamie Thompson <bishbashboshjt@gmail.com>
@bishabosha I've rebased again and now it seems to be fine, especially if it was unrelated to my changes. Looking at the benchmarks, they don't seem to deviate significantly. What do you think? |
thanks a lot :) |
extension_
name prefix for value definitionsextension
variable names illegal (addressing Cannot implement setter method forvar extension
#9926)