8000 Skip rest of file upon top-level always-false assert by gvanrossum · Pull Request #5894 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Skip rest of file upon top-level always-false assert #5894

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 5 commits into from
Nov 15, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Test that an assert inside an always-true if doesn't have the magic
  • Loading branch information
Guido van Rossum committed Nov 14, 2018
commit 5f060ac3a677a84d7a96929e7df7855a6e722c3f
8 changes: 8 additions & 0 deletions test-data/unit/check-unreachable-code.test
Original file line number Diff line number Diff line change
Expand Up @@ -671,3 +671,11 @@ import sys
assert sys.platform == 'lol'
def bar() -> None: pass
[builtins fixtures/ops.pyi]

[case testUnreachableAfterToplevelAssertNotInsideIf]
import sys
if sys.version_info[0] >= 2:
assert sys.platform == 'lol'
reveal_type('') # E: Revealed type is 'builtins.str'
reveal_type('') # E: Revealed type is 'builtins.str'
[builtins fixtures/ops.pyi]
0