-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Unreachability depends on statement ordering #18901
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
Unreachability depends on statement ordering #18901
Comments
Ough. Lines 111 to 160 in c7ea011
Not only it fails to account for your case, but also forgets the negation sometimes, e.g. This should be priority-1-normal IMO, but I'm not sure I'm supposed to add priority labels, let's leave this to maintainers? |
Yeah, the negation is indeed lost, playground: import sys
if sys.platform == 'linux':
# sanity check: ensure playground runs on linux
1 + a # E
if not sys.platform == 'win32':
# also good, linux is not win32
1 + 'a' # E
if not (sys.platform == 'win32' or sys.platform == 'win32'):
# well, check it twice and you're doomed
1 + 'a' |
Bug Report
X and sys.platform == "win32"
does not mark the block as unreachable, butsys.platform == "win32" and X
does. This probably has been reported before but I'm not sure how to phrase this let alone search issues.To Reproduce
Expected Behavior
I expect the branch to be unreachable, so the
reveal_type
should not show anythingYour Environment
Reproduced in mypy play.
mypy.ini
(and other config files): N/AThe text was updated successfully, but these errors were encountered: