-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Incompatible Override Self Distinction #5288
Labels
addressed in next version
Issue is fixed and will appear in next published version
bug
Something isn't working
Comments
erictraut
pushed a commit
that referenced
this issue
Jun 14, 2023
…atibleMethodOverride` check when a child class is overriding an overloaded method in the base class and one or more of the overloads doesn't apply because the `self` or `cls` parameter is explicitly annotated in a way that's not applicable to the child class. This addresses #5288.
erictraut
pushed a commit
that referenced
this issue
Jun 14, 2023
…atibleMethodOverride` check when a child class is overriding an overloaded method in the base class and one or more of the overloads doesn't apply because the `self` or `cls` parameter is explicitly annotated in a way that's not applicable to the child class. This addresses #5288.
erictraut
added a commit
that referenced
this issue
Jun 14, 2023
…atibleMethodOverride` check when a child class is overriding an overloaded method in the base class and one or more of the overloads doesn't apply because the `self` or `cls` parameter is explicitly annotated in a way that's not applicable to the child class. This addresses #5288. (#5302) Co-authored-by: Eric Traut <[email protected]>
Thanks for the bug report. This will be addressed in the next release. |
erictraut
added
the
addressed in next version
Issue is fixed and will appear in next published version
label
Jun 14, 2023
This is included in pyright 1.1.315, which I just published. It will also be included in this week's insiders release of pylance. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
addressed in next version
Issue is fixed and will appear in next published version
bug
Something isn't working
Describe the bug
Produces a type error of incompatible override.
Expected behavior
I would expect no error. The Foo[int] overload should not be applicable because it's only if T = int, while Bar has T set to str.
VS Code extension or command-line
pyright 1.1.314
Additional context
The real version I hit with this error can actually be found with this definition in typeshed. One overload handles most common case as most of the time typevar has that specific type. Other overload fallsback to Any as I don't think it's possible to describe behavior in general today. That approach seems to produce incompatible overrides now.
I'll also note mypy --strict passes here and doesn't mark the override as incompatible. Unsure if it has self special rules or is just laxer here.
The text was updated successfully, but these errors were encountered: