Skip to content

Do not warn on returning any from deferred node #4295

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 2 commits into from
Nov 30, 2017

Conversation

elazarg
Copy link
Contributor

@elazarg elazarg commented Nov 30, 2017

Fix #4296

The access to member defined in __init__ causes the current node to be deferred, so mypy assumes expressions are Any but should not warn about it.

This is not the only conceivable fix - for example, I'm not sure why mypy should continue checking the function in the first place.

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, LGTM -- just one minor comment.

class A:
def __init__(self, x: int) -> None:
self._x = x

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty lines at the end of the file.

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.

Strange "Returning Any" warning
2 participants