Closed
Description
from typing import TypeVar
T = TypeVar('T')
def f() -> T: # no error
...
if f():
print() # Statement is unreachable
else:
print() # Statement is unreachable
Actual Behavior
No error in f
definition. Two unreachable
errors inside if f(): ... else: ...
Expected Behavior
Error in f
definition. For example:
Type variable "T" is unbound
(Hint: Use "T" in function arguments to bind "T" to return type)
No errors inside if f(): ... else: ...
My Environment
mypy 0.961 (compiled: no)
- no command-line flags, no config file
CPython 3.10.4
- Windows 10