-
Notifications
You must be signed in to change notification settings - Fork 239
Check re-assignment of Final variables in less-common binding constructs
#1925
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
Check re-assignment of Final variables in less-common binding constructs
#1925
Conversation
Final variables in less-common binding constructs
This comment has been minimized.
This comment has been minimized.
yangdanny97
left a comment
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.
This LGTM, but I'll wait to import till after #1923 is merged
In this diff, we check for final annotations in unpacking assignments (e.g. when LHS is a tuple or list), and raise an error if a final variable is re-assigned. One fewer difference for conformance tests.
In this diff, we check whether the loop variable is marked final, and raise an error if that's the case. One fewer difference for conformance tests.
90e81b9 to
1e42a87
Compare
|
Rebased |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
|
@yangdanny97 has imported this pull request. If you are a Meta employee, you can view this in D89935200. |
kinto0
left a comment
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.
Review automatically exported from Phabricator review in Meta.
|
@yangdanny97 merged this pull request in cf29d5f. |
Summary
This diff extends existing re-assignment checks for variables declared as
Finalto a few other binding constructs that are less common (namely unpacking assignments, context manager assignments, and loop variable assignments). Overall, we have 3 more passing conformance test cases.Test Plan
python test.py