Skip to content

Fix #3918: Record names of mutated fields instead of symbols. #4535

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
Jul 17, 2021

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented Jul 17, 2021

The analysis in the issue shows that scalac generates different symbols for the same field in rare situations: one in the class info decls, and another one in the trees. This was a problem for our unexpectedMutatedField handling.

We work around this issue by storing the names of the mutated fields, instead of their symbols. By only doing that for fields in the current class, we ensure that it remains non ambiguous. In addition, we store the names of all mutated fields, not only the ones that were not "suspected" to be mutable; in 2.13, the symbol in the trees is correctly marked as mutable but not the one in the class decls.

The analysis in the issue shows that scalac generates different
symbols for the same field in rare situations: one in the class
info decls, and another one in the trees. This was a problem for
our `unexpectedMutatedField` handling.

We work around this issue by storing the *names* of the mutated
fields, instead of their symbols. By only doing that for fields in
the current class, we ensure that it remains non ambiguous. In
addition, we store the names of all mutated fields, not only the
ones that were not "suspected" to be mutable; in 2.13, the symbol
in the trees is correctly marked as mutable but not the one in the
class decls.
@gzm0 gzm0 merged commit 3ff7d72 into scala-js:master Jul 17, 2021
@sjrd sjrd deleted the fix-mixed-in-field-mutable-bug branch July 17, 2021 20:39
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.

Mixed-in field in class inside lazy val rhs is erroneously immutable in the IR -> IR checking error
2 participants