You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect mypy behaviour when inheriting a generic with List[T] field #10986
fromdataclassesimportdataclassfromtypingimportGeneric, List, TypeVarT=TypeVar('T', int, str)
@dataclassclassA(Generic[T]):
x: List[T]
@dataclassclassB(A[int]):
passB(x=[1]) # error: List item 0 has incompatible type "int"; expected "T"
mypy 0.910 gives error: List item 0 has incompatible type "int"; expected "T" that is not what I expected since I declared x as List[int] with generic inheritance.
Activity
ilevkivskyi commentedon Nov 16, 2022
FWIW this works correctly on the current master.