-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Classes break overload checking #11606
New issue
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
Comments
This happens because for some reason left and right are It does not pass this check: Lines 1058 to 1077 in b47245a
In contrast to regular functions: Notice that |
This is a corner case of using But, another question is: should we support this corner case? When declaring |
Here's the valid code for this case: class Blah:
@overload
def f(self, a: str, /) -> None: ...
@overload
def f(self, /, *, b: bool = False) -> None: ...
def f(self, a: str | None = None, /, *, b: bool = False) -> None:
... It works: |
Didn't think of it that way, that is true. That's really an interesting point though, so... Hmmmm... I think I see what I need to do, thanks. |
* Add a thin veneer of compatibility with mypy * Run nox * Remove unused type ignore * Fix overloads based on python/mypy#11606 * PR feedback * Update to latest changes * PR review * More PR feedback * Revert slots from protocols
See python#11606 for discussion
Bug Report
A certain overloaded function works, but when put in a class no longer works.
To Reproduce
Expected Behavior
For this case, as the
self
argument is not annotated and is always there, mypy shouldn't report any issues.Actual Behavior
Your Environment
Reproduced in mypy playground: https://mypy-play.net/?mypy=master&python=3.10&flags=strict&gist=d2c0e39b68def2cd02633caeded68e3f
The text was updated successfully, but these errors were encountered: