diff --git a/mypy/plugins/dataclasses.py b/mypy/plugins/dataclasses.py index 8b34c28b6832..d8b1d2ffcc78 100644 --- a/mypy/plugins/dataclasses.py +++ b/mypy/plugins/dataclasses.py @@ -375,9 +375,7 @@ def transform(self) -> bool: add_attribute_to_class(self._api, self._cls, "__match_args__", match_args_type) self._add_dataclass_fields_magic_attribute() - - if self._spec is _TRANSFORM_SPEC_FOR_DATACLASSES: - self._add_internal_replace_method(attributes) + self._add_internal_replace_method(attributes) if "__post_init__" in info.names: self._add_internal_post_init_method(attributes)