-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Inconsistent types for variable with partial type #4484
Copy link
Copy link
Open
Labels
Description
In the example below the variable seemingly has two types (None and x) which is wrong. This also results in an inconsistency with fine-grained incremental mode.
x = None
def f() -> None:
reveal_type(x) # None
if x:
1() # No error, considered as not reachable
y = 1
else:
y = '' # No error
x = 1
reveal_type(x) # intThe expected behavior is for x to always have the type int and for every line in the example to be considered reachable.
Reactions are currently unavailable