Closed
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