Skip to content

Hashable and List are considered overlapping #7328

Closed
@shoyer

Description

@shoyer

I think this is a bug:

from typing import Hashable, List, overload

@overload
def f(x: Hashable) -> str: ...

@overload
def f(x: List) -> str: ...

def f(x):
    return repr(x)

mypy (0.720) reports:

typing_test.py:7: error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader

I would expect this to work without complaints. Python lists are not hashable, unless you make some strange subclass.

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