-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongpriority-0-hightopic-type-narrowingConditional type narrowing / binderConditional type narrowing / binder
Description
Regression in 0.920 / 0.930 compared with 0.910.
from typing import Any
def func() -> Any:
...
var = func()
reveal_type(var) # Any
assert isinstance(var, bool)
reveal_type(var) # bool
if var:
reveal_type(var) # Literal[True]
pass
reveal_type(var) # Any -> should still be 'bool'!The type should not be lost if it can't be narrowed to Literal[True] or Literal[False]. It's a side effect of #10389. The issue was already mentioned #10389 (comment) but hasn't been addressed yet.
/CC: @ethan-leba
orsinium, Skylion007 and Fogapod
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongpriority-0-hightopic-type-narrowingConditional type narrowing / binderConditional type narrowing / binder