fix: prevent false unreachable error when comparing generic callables by Bahtya · Pull Request #21188 · python/mypy

and others added 2 commits

April 9, 2026 02:56
When comparing a generic Callable parameter with a generic function
using ==, mypy incorrectly concluded the types could never overlap
and marked the if-body as unreachable.

Fix by extending shallow_erase_type_for_equality to handle CallableType
and using erased current_type in the equality overlap checks.

Fixes python#21182

Signed-off-by: bahtya <bahtyar153@qq.com>

hauntsaninja