-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix #5568: Allow nested classes as return annotations #5688
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
Fix #5568: Allow nested classes as return annotations #5688
Conversation
maybe_before_assign = False | ||
annotation_return = True | ||
if ( | ||
frame.returns.name in defframe.locals |
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.
The only substantive change in the PR is to change defframe.name
to frame.returns.name
. The rest is just refactoring for readability and avoiding re-checking the same boolean maybe_before_assign
.
Pull Request Test Coverage Report for Build 1704780241
π - Coveralls |
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 the little refactor on top of the fix π !
Co-authored-by: Pierre Sassoulas <[email protected]>
for more information, see https://pre-commit.ci
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.
Thanks once again @jacobtylerwalls!
Type of Changes
Description
The
undefined-variable
checker had a special case for return annotations matching the name of the containing class, but this missed other nested classes like anamedtuple
used as a class attribute.Closes #5568