Open
Description
I'm seeing an Incompatible return value type error in 0.981 that wasn't present in previous versions of mypy.
To Reproduce
from typing import TypeVar
T = TypeVar("T", dict, float)
def method(x: T) -> T:
if isinstance(x, dict):
return {}
else:
return 0.0
Expected Behavior
% mypy --version
mypy 0.971 (compiled: yes)
% mypy test-mypy-error.py
Success: no issues found in 1 source file
Actual Behavior
% mypy --version
mypy 0.981 (compiled: yes)
% mypy test-mypy-error.py
[Success: no issues found in 1 source file](test-mypy-error.py:7: error: Incompatible return value type (got "Dict[<nothing>, <nothing>]", expected "float"))
Your Environment
mypy version 0.981
python version 3.9.13