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
from typing import Generic, TypeVar
import dataclasses
T = TypeVar('T')
@dataclasses.dataclass()
class A(Generic[T]):
attr: T
A(attr=0) # OK!
@dataclasses.dataclass()
class B(A[float]):
...
B(attr=float(0))
# Argument "attr" to "B" has incompatible type "float"; expected "T"
fails with "Argument "attr" to "B" has incompatible type "float"; expected "T"" error in mypy. But the B class specifies T to be float, how to fix that error?
The text was updated successfully, but these errors were encountered:
The following MWE:
fails with "Argument "attr" to "B" has incompatible type "float"; expected "T"" error in mypy. But the
B
class specifiesT
to befloat
, how to fix that error?The text was updated successfully, but these errors were encountered: