Skip to content

False positive: signature incompatible with supertype if subtype has overloads #14725

@gsakkis

Description

@gsakkis

Bug Report

This is similar to #13106 but the method is @overloaded in the subtype instead of the supertype.

To Reproduce
playground link

Actual Behavior

main.py:11: error: Signature of "f" incompatible with supertype "Parent"  [override]
main.py:11: note:      Superclass:
main.py:11: note:          def f(self, i: Union[int, slice]) -> Any
main.py:11: note:      Subclass:
main.py:11: note:          @overload
main.py:11: note:          def f(self, i: int) -> Any
main.py:11: note:          @overload
main.py:11: note:          def f(self, i: slice) -> Any
Found 1 error in 1 file (checked 1 source file)

Your Environment

  • Mypy version used: 1.0.0
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.8.16

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions