Bug Report
Since mypy 1.20.0, a comparison between 2 generic callables may cause "Statement is unreachable"
To Reproduce
from typing import Callable
def identity[T](x: T) -> T:
return x
def msg[T,S](cmp_property: Callable[[T], S]) -> None:
if cmp_property == identity:
return
Expected Behavior
Mypy should not report any error.
Actual Behavior
scpytools/kk.py: note: In function "msg":
scpytools/kk.py:10: error: Statement is unreachable [unreachable]
return
^~~~~~
Your Environment
- Mypy version used: mypy 1.20.0 (compiled: yes)
- Mypy command-line flags: mypy --warn-unreachable
- Mypy configuration options from
mypy.ini (and other config files): No config files
- Python version used: 3.14.2
Bug Report
Since mypy 1.20.0, a comparison between 2 generic callables may cause "Statement is unreachable"
To Reproduce
Expected Behavior
Mypy should not report any error.
Actual Behavior
Your Environment
mypy.ini(and other config files): No config files