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

Signatures of overloaded methods are incompatible with supertypes, even if they really are #3262

Closed
refi64 opened this issue Apr 26, 2017 · 6 comments

Comments

@refi64
Copy link
Contributor

refi64 commented Apr 26, 2017

e.g.

from typing import overload

class A:
    @overload
    def f(self, x: str) -> str: ...
    @overload
    def f(self, y: int) -> int: ...

class B(A):
    @overload
    def f(self, x: str) -> str: ...
    @overload
    def f(self, y: int) -> int: ...
    @overload
    def f(self, z: bytes) -> bytes: ...

IMO in this case, it should still be compatible, since B supports A's full API, just with another extra function.

@sixolet
Copy link
Collaborator

sixolet commented Apr 26, 2017 via email

@refi64
Copy link
Contributor Author

refi64 commented Apr 26, 2017

@sixolet I think you might be around 10 seconds too late... ;)

@gvanrossum
Copy link
Member

@sixolet Can you review @kirbyfan64's review?

@sixolet
Copy link
Collaborator

sixolet commented Apr 26, 2017 via email

refi64 added a commit to refi64/mypy that referenced this issue Apr 27, 2017
refi64 added a commit to refi64/mypy that referenced this issue Apr 28, 2017
@gvanrossum
Copy link
Member

Did this get fixed or not?

@sixolet
Copy link
Collaborator

sixolet commented May 10, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants