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

@override does not work correctly for overloaded method without implementation #9746

Open
erictraut opened this issue Jan 23, 2025 · 0 comments
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working spec compliance

Comments

@erictraut
Copy link
Collaborator

If an overloaded method has no implementation (e.g. it's in a stub file, protocol or ABC) and the first overloaded method is decorated with @override, this override isn't enforced.

class Base(Protocol):
    pass


class Subclass(Base, Protocol):
    @overload
    @override
    # This should generate an error because method isn't present in the base.
    def method(self, x: int) -> int: ...
    @overload
    def method2(self, x: str) -> str: ...
@erictraut erictraut added bug Something isn't working spec compliance labels Jan 23, 2025
erictraut added a commit that referenced this issue Jan 23, 2025
@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Jan 23, 2025
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 spec compliance
Projects
None yet
Development

No branches or pull requests

1 participant