Skip to content

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

Closed

Description

@refi64

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.

Activity

  1. sixolet commented on Apr 26, 2017

    @sixolet
    Collaborator
  2. refi64 commented on Apr 26, 2017

    @refi64
    ContributorAuthor

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

  3. added a commit that references this issue on Apr 26, 2017
    129ad44
  4. gvanrossum commented on Apr 26, 2017

    @gvanrossum
    Member

    @sixolet Can you review @kirbyfan64's review?

  5. sixolet commented on Apr 26, 2017

    @sixolet
    Collaborator
  6. added 2 commits that reference this issue on Apr 27, 2017
    f56f49c
    d1ec354
  7. gvanrossum commented on May 10, 2017

    @gvanrossum
    Member

    Did this get fixed or not?

  8. sixolet commented on May 10, 2017

    @sixolet
    Collaborator
  9. added a commit that references this issue on Jan 15, 2018
    d187ab3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions