Bug Report
In the following code snippet, mypy incorrectly infers the type of typ as _typeshed.DataclassInstance. This issue was not present in previous versions of mypy
To Reproduce
fromdataclassesimportdataclass, is_dataclassfromtypingimportTypeVar, Any, Type, cast@dataclassclassA:
a: intT=TypeVar('T')
defparse(typ: Type[T], raw: dict[str, Any]) ->T:
ifnotis_dataclass(typ):
raiseException('Unsupported type')
parsed=typ(**raw) # type: ignore[call-arg]returnparsedparse(A, {'a': 2})Expected Behavior
There should be no type error
Actual Behavior
Incompatible return value type (got "DataclassInstance", expected "T") \[return-value\]
Your Environment
- Mypy version used: 1.1.1
- Python version used: 3.11
Bug Report
In the following code snippet, mypy incorrectly infers the type of typ as _typeshed.DataclassInstance. This issue was not present in previous versions of mypy
To Reproduce
Expected Behavior
There should be no type error
Actual Behavior
Incompatible return value type (got "DataclassInstance", expected "T") \[return-value\]Your Environment