-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for jump statements in partially defined vars check (#13632)
This builds on #13601 to add support for statements like `continue`, `break`, `return`, `raise` in partially defined variables check. The simplest example is: ```python def f1() -> int: if int(): x = 1 else: return 0 return x ``` Previously, mypy would generate a false positive on the last line of example. See test cases for more details. Adding this support was relatively simple, given all the already existing code. Things that aren't supported yet: `match`, `with`, and detecting unreachable blocks. After this PR, when enabling this check on mypy itself, it generates 18 errors, all of them are potential bugs.
- Loading branch information
Showing
4 changed files
with
300 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.