Closed
Description
Using mypy 0.782, it looks like overlap is only checked on dictionary keys.
from typing import Dict, overload
class A: pass
class B: pass
@overload
def foo(x: Dict[A, A]) -> A: ...
@overload
def foo(x: Dict[A, B]) -> B: ...
def foo(x):
for k, v in x: return v
raise ValueError
gives error: Overloaded function signatures 1 and 2 overlap with incompatible return types
. I get the same error when using Mapping
instead of `Dict.