Closed
Description
Bug Report
from typing import overload, Union, Callable, Any
Scalar = Union[int, float, complex] # shows the error
# Scalar = complex # hides the error
class A: ...
class B: ...
@overload
def apply(self, func: Callable[[A], Scalar]) -> B: ...
# error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
@overload
def apply(self, func: Callable[[Any], float]) -> A: ...
Expected Behavior
In both cases the overloads should be overlapping.
Your Environment
- Mypy version used: 0.971 and 0.981
- Python version used: 3.10