Skip to content
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

False negative for overridden signature mismatch #3260

Closed
jab opened this issue Mar 26, 2022 · 2 comments
Closed

False negative for overridden signature mismatch #3260

jab opened this issue Mar 26, 2022 · 2 comments
Labels
as designed Not a bug, working as intended

Comments

@jab
Copy link

jab commented Mar 26, 2022

Based on python/mypy#12390 (comment) it looks like this was meant to be addressed in a recent release, but I'm still reproducing this false negative using Pyright 1.1.232.

Example:

import typing as t


class A:
    @t.overload
    def pop(self) -> int: ...
    @t.overload
    def pop(self, d: int = ...) -> int: ...
    
    def pop(self, d: int = ...) -> int: ...


class B(A):
    @t.overload
    def pop(self) -> int: ...
    @t.overload
    def pop(self, d: int) -> int: ...  # Forgot to make `d` a keyword arg in this overload
    
    def pop(self, d: int = ...) -> int: ...
pyright test.py
No configuration file found.
No pyproject.toml file found.
stubPath /private/tmp/typings is not a valid directory.
Assuming Python platform Darwin
Searching for source files
Found 1 source file
0 errors, 0 warnings, 0 informations
Completed in 0.59sec
@erictraut
Copy link
Collaborator

This is intended behavior. Pyright doesn't attempt to validate overrides when overloads are involved. I don't think this is a tractable problem in general.

@erictraut erictraut added the as designed Not a bug, working as intended label Mar 27, 2022
@jab
Copy link
Author

jab commented Mar 28, 2022

Didn't realize you'd changed your mind about this. Fair enough and good to know, thanks for the update.

debonte pushed a commit to debonte/pyright that referenced this issue Mar 15, 2023
…icrosoft#3260)

* added files and etc to package.json for pylance-server npm package

* updated lock json file

* fixed code style error

* some tweak

* change main and typing folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
as designed Not a bug, working as intended
Projects
None yet
Development

No branches or pull requests

2 participants