Open
Description
Bug Report
There is an inconsistency left where currently TypeIs/TypeGuard
narrows in case of multi-Any matches, while this is not done in normal overloads. I find this strange and would prefer that it is consistent.
To Reproduce
@overload
def func1(x: str) -> TypeIs[str]:
...
@overload
def func1(x: int) -> TypeIs[int]:
...
def func1(x: Any) -> Any:
return True
def func2(val: Any):
if func1(val):
reveal_type(val) # Currently int | str
@overload
def func3(x: str) -> str:
...
@overload
def func3(x: int) -> int:
...
def func3(x: Any) -> Any:
return True
def func4(val: Any):
reveal_type(func3(val)) # Currently Any