diff --git a/mypy/nodes.py b/mypy/nodes.py index 72a23d4f0789..d5ce8d675127 100644 --- a/mypy/nodes.py +++ b/mypy/nodes.py @@ -3915,7 +3915,7 @@ def serialize(self) -> JsonDict: "eq_default": self.eq_default, "order_default": self.order_default, "kw_only_default": self.kw_only_default, - "frozen_only_default": self.frozen_default, + "frozen_default": self.frozen_default, "field_specifiers": list(self.field_specifiers), } diff --git a/test-data/unit/fine-grained-dataclass-transform.test b/test-data/unit/fine-grained-dataclass-transform.test index 7dc852f1d733..3abba0892ae8 100644 --- a/test-data/unit/fine-grained-dataclass-transform.test +++ b/test-data/unit/fine-grained-dataclass-transform.test @@ -90,3 +90,45 @@ builtins.pyi:12: note: "B" defined here main:7: error: Unexpected keyword argument "y" for "B" builtins.pyi:12: note: "B" defined here == + +[case frozenStays] +# flags: --python-version 3.11 +from foo import Foo + +foo = Foo(base=0, foo=1) + +[file transform.py] +from typing import dataclass_transform, Type + +@dataclass_transform(frozen_default=True) +def dataclass(cls: Type) -> Type: return cls + +[file base.py] +from transform import dataclass + +@dataclass +class Base: + base: int + +[file foo.py] +from base import Base +from transform import dataclass + +@dataclass +class Foo(Base): + foo: int + +[file foo.py.2] +from base import Base +from transform import dataclass + +@dataclass +class Foo(Base): + foo: int + bar: int = 0 + +[typing fixtures/typing-full.pyi] +[builtins fixtures/dataclasses.pyi] + +[out] +==