Closed
Description
mypy 0.620, --strict
.
Sample code:
import abc
from dataclasses import dataclass
@dataclass # error: Only concrete class can be given where "Type[Abstract]" is expected
class Abstract(metaclass=abc.ABCMeta):
a: str
@abc.abstractmethod
def c(self) -> None:
pass
@dataclass
class Concrete(Abstract):
b: str
def c(self) -> None:
pass
instance = Concrete(a='hello', b='world')
Note that this error only occurs if at least one abstract method is defined on the abstract class. Removing the abstract method c
(or making it non-abstract) makes the error go away.