Skip to content

Support unreachable blocks in partially defined check #13929

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

Closed
ilinum opened this issue Oct 20, 2022 · 0 comments · Fixed by #14161
Closed

Support unreachable blocks in partially defined check #13929

ilinum opened this issue Oct 20, 2022 · 0 comments · Fixed by #14161
Labels
feature topic-possibly-undefined possibly-undefined error code

Comments

@ilinum
Copy link
Collaborator

ilinum commented Oct 20, 2022

For the partially defined check (--enable-error-code partially-defined), mypy should detect unreachable blocks:

Assuming we're running python3.6 in the following block:

if sys.version_info >= (3, 6):
    x = 1
print(x)  # This should not generate an error but currently does.
@ilinum ilinum added feature topic-possibly-undefined possibly-undefined error code labels Oct 20, 2022
JukkaL pushed a commit that referenced this issue Nov 22, 2022
This adds support for unreachable blocks in `partially-defined` check.

Currently, this only supports blocks that are detected as unreachable
during semantic analysis (so mostly stuff like python version, etc.).
This doesn't support more advanced cases (see #13926 for an example
what's not covered).

Closes #13929
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature topic-possibly-undefined possibly-undefined error code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant