diff --git a/mypy/checker.py b/mypy/checker.py index 70db31c9a94f..5c481c7a73ec 100644 --- a/mypy/checker.py +++ b/mypy/checker.py @@ -1924,11 +1924,14 @@ def check_explicit_override_decorator( found_method_base_classes: list[TypeInfo] | None, context: Context | None = None, ) -> None: + sym = defn.info.get(defn.name) if ( found_method_base_classes and not defn.is_explicit_override and defn.name not in ("__init__", "__new__") and not is_private(defn.name) + and sym is not None + and not sym.plugin_generated ): self.msg.explicit_override_decorator_missing( defn.name, found_method_base_classes[0].fullname, context or defn diff --git a/test-data/unit/check-dataclasses.test b/test-data/unit/check-dataclasses.test index 924f9c7bb5be..955adb001820 100644 --- a/test-data/unit/check-dataclasses.test +++ b/test-data/unit/check-dataclasses.test @@ -2465,7 +2465,7 @@ class Foo: [case testDataclassInheritanceWorksWithExplicitOverrides] # flags: --enable-error-code explicit-override -from dataclasses import dataclass +from dataclasses import dataclass @dataclass class Base: @@ -2475,3 +2475,16 @@ class Base: class Child(Base): y: int [builtins fixtures/dataclasses.pyi] + +[case testDataclassInheritanceWorksWithExplicitOverridesAndOrdering] +# flags: --enable-error-code explicit-override +from dataclasses import dataclass + +@dataclass(order=True) +class Base: + x: int + +@dataclass(order=True) +class Child(Base): + y: int +[builtins fixtures/dataclasses.pyi]