Closed
Description
To Reproduce
from typing import TypeVar
T = TypeVar("T")
def fun(x: T, klass: type) -> T:
if not isinstance(x, klass):
raise TypeError
return x
Expected Behavior
No error.
Actual Behavior
error: Incompatible return value type (got "object", expected "T") [return-value]
Your Environment
- Mypy version used: 0.971