Skip to content

Specilizing Union method parameters on subclasses #6411

Closed
@athoscouto

Description

@athoscouto

Feature Request
Extend feature added in #424 to allow subclasses to also specialize method parameters that contain Union type.

Code example

class A():
    def x(self, x: Union[Dict, List]):
        pass


class B(A):
    def x(self, x: Dict):
        pass

mypy output
error: Argument 1 of "x" incompatible with supertype "A"

Expected output
Nothing :)

mypy/python version
mypy 0.641
Python 3.6.7

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