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:56When 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters