-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongtopic-reachabilityDetecting unreachable codeDetecting unreachable codetopic-type-narrowingConditional type narrowing / binderConditional type narrowing / binder
Description
a: int | None
a = None
for i in range(10):
reveal_type(a) # "None" and also "int | None"
if a:
print(a) # error: unreachable
a = i
Also:
a = None
for b in [1, 2]:
if a is None:
a = b
continue
print("hi") # false unreachable error
DetachHead, KotlinIsland, Loch64, scott-au, Zeckie and 1 more
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-reachabilityDetecting unreachable codeDetecting unreachable codetopic-type-narrowingConditional type narrowing / binderConditional type narrowing / binder