You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
@overloaddeffunc1(x: str) ->TypeIs[str]:
...
@overloaddeffunc1(x: int) ->TypeIs[int]:
...
deffunc1(x: Any) ->Any:
returnTruedeffunc2(val: Any):
iffunc1(val):
reveal_type(val) # Currently int | str@overloaddeffunc3(x: str) ->str:
...
@overloaddeffunc3(x: int) ->int:
...
deffunc3(x: Any) ->Any:
returnTruedeffunc4(val: Any):
reveal_type(func3(val)) # Currently Any
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
Playground (used Mypy 1.15)
The text was updated successfully, but these errors were encountered: