Skip to content
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

Always keep a field for private[this] var class parameters #9226

Merged
merged 2 commits into from Sep 28, 2020

Commits on Sep 28, 2020

  1. Keep private[this] var class parameter fields that are only read

    Reads of `var` class parameters in the constructor are not rewritten to
    the constructor parameter, they keep referring to the field to ensure
    potential field writes are reflected (this was fixed in scala#7688).
    
    This means that the corresponding field cannot be elided even if it's
    never written.
    
    The alternative solution would be to detect `private[this] var` fields
    that are only read in the constructor. However this is difficult to
    implement, see scala#9143.
    lrytz committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    7366f41 View commit details
    Browse the repository at this point in the history
  2. Never elide fields for private[this] var class parameters

    After the previous commit, the field for a `private[this] var` class
    parameter is only elided if the field is not used at all. This seems
    not to be worth the effort.
    lrytz committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    9a11180 View commit details
    Browse the repository at this point in the history