We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Any
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug Report The behavior of overload is not properly matching when one of the arguments is Any.
overload
See microsoft/pyright#5216 (comment)
To Reproduce
from typing import Any, Literal, TypeVar, overload _T = TypeVar("_T") class A: @overload def method1(self, k: Literal["hi"], default: Any) -> float: ... @overload def method1(self, k: str, default: _T) -> Any | _T: ... def method1(self, k: str, default: _T) -> Any | _T: ... def func(a: A, b: list, c: Any): v1 = a.method1("hi", []) reveal_type(v1) # mypy: float my_list1: list = [] v2 = a.method1("hi", my_list1) reveal_type(v2) # mypy: Any v3 = a.method1("hi", b) reveal_type(v3) # mypy: Any v4 = a.method1("hi", c) reveal_type(v4) # mypy: Any my_list2: list[int] = [] v5 = a.method1("hi", my_list2) reveal_type(v5) # mypy: float``` **Expected Behavior** All of the revealed types should have been `float`, since the first argument of each call to `method1()` is `"hi"`. This is the behavior of `pyright`, which seems to make more sense. **Actual Behavior** ```text overload.py:19: note: Revealed type is "builtins.float" overload.py:23: note: Revealed type is "Any" overload.py:26: note: Revealed type is "Any" overload.py:29: note: Revealed type is "Any" overload.py:33: note: Revealed type is "builtins.float"
Your Environment
mypy.ini
The text was updated successfully, but these errors were encountered:
TimestampSeries
TimedeltaSeries
No branches or pull requests
Bug Report
The behavior of
overload
is not properly matching when one of the arguments isAny
.See microsoft/pyright#5216 (comment)
To Reproduce
Your Environment
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: