Skip to content

Fix #1878: Generate fields for final vars. #1879

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

Merged
merged 1 commit into from
Jan 5, 2017

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@odersky
Copy link
Contributor

odersky commented Jan 5, 2017

LGTM!

@odersky odersky merged commit 2498cf9 into scala:master Jan 5, 2017
@smarter
Copy link
Member

smarter commented Jan 5, 2017

I still think it would be simpler to drop the Final flag on final var x instead of adding special cases everytime we check Final.

@odersky
Copy link
Contributor

odersky commented Jan 7, 2017

@smarter @nicolasstucki Actually, it should be the other way round. Final has no place indicating constness, we now have Inline for that. So what we should do is

  • Make sure that final vals read from Scala 2 have the inline flag set.
  • As a temporary measure also set Inline for final vals in Dotty source, so that we can
    for the moment stay compatible with Scalac.
  • Base all constness logic on inline, not final.

@nicolasstucki Can you roll back this PR and implement the scheme outlined above? I believe a lot of it is already implemented that way, but it would be good to check.

@nicolasstucki
Copy link
Contributor Author

Will do.

Small refinement to the first rule: it is only if the RHS of the final value is idempotent.

nicolasstucki added a commit to dotty-staging/dotty that referenced this pull request Jan 9, 2017
Also move final val inlining logic to Inline as mentioned
in scala#1879.
nicolasstucki added a commit to dotty-staging/dotty that referenced this pull request Jan 9, 2017
Also move final val inlining logic to Inline as mentioned in scala#1879.
nicolasstucki added a commit to dotty-staging/dotty that referenced this pull request Jan 9, 2017
Also move final val inlining logic to Inline as mentioned in scala#1879.
@allanrenucci allanrenucci deleted the fix-final-vars branch December 14, 2017 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants