Open DetachHead opened 2 years ago
The title of this bug is misleading. The real bug here is that mypy doesn't report a type violation for f(lambda x: x)
. This lambda doesn't satisfy either Callable[[int], None]
or Callable[[int, str], None]
, so it should be flagged as a type violation.
it still happens when the lambda does satisfy one of the types in the union:
from typing import Callable
def f(a: Callable[[int], int] | Callable[[int, str], None]) -> None: ...
f(lambda x: reveal_type(x)) # Any
i guess that was a mistake in my original post but that means there are two different issues here
playground