Skip to content

missing-override-decorator false positive when assigning to inherited property #3385

Closed

Description

@aatle

Describe the Bug

If a child class assigns to a property (with a setter) defined in a base class, missing-override-decorator incorrectly flags it, as if the assignment was an implicit override.

class Base:
    def __init__(self) -> None:
        self.attr = 0

    @property
    def prop(self) -> int:
        return self.attr

    @prop.setter
    def prop(self, value: int) -> None:
        self.attr = value


class Sub1(Base):
    def __init__(self, prop: int) -> None:
        super().__init__()
        self.prop = prop


class Sub2(Base):
    def update(self, prop: int) -> None:
        self.prop = prop
ERROR sandbox.py:17:14-18: Class member `Sub1.prop` overrides a member in a parent class but is missing an `@override` decorator [[missing-override-decorator](https://pyrefly.org/en/docs/error-kinds/#missing-override-decorator)]
ERROR sandbox.py:22:14-18: Class member `Sub2.prop` overrides a member in a parent class but is missing an `@override` decorator [[missing-override-decorator](https://pyrefly.org/en/docs/error-kinds/#missing-override-decorator)]

Expected: no error when assigning to base class property; treat instance-level property access like an attribute, not method.

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSIAxlKnHAAQBCtMiAOuvV-ZjGPQH0BEdBAAuQgBRwYUMAEp6AWgB89AHK50rDtz30ZcwqjFiATvQC89AAwdd3AALEzuYjDNjSDrr34u3aVkFZTURMXZOfS4zGDEAVzNOQzBjUzN7KK5nV2JCGVMPHx4%2BegDiILkAGnoAN1QoeNZ6cMVVDS0dLP0UtPMrOoamzI5qWgYAZXjsAEZJZhl5SL0-QWFRCQFKsBryxBb0MTa1TW1l6IN49zNJeUIhEXEpeWK9XvKB8pH0Mbp6KewACZ5iwlsVVldMCYYNtdrl9q1Qh0zq9uO9cp9chwQFUQGRYmAoKRCGJcABbKAUADE9AACqQCUSDBgcAR6JQtJAAOaJEwQLSEDg0iYwGD0AAWpmIcEQAHpZfi%2BETCLgzFzZTB0LLMLhKHBZRz0NzeWJ%2BVr6GBVfRUPVoKhsLB2ZyIDyzHytPQ3KatHBBegyGJxVolLUPHAzQM2CAAMyEGaAqMcADaHlcZjgAF0OPFRGTiKqxDBMEpMBBYpRTaGBgByF3oVUwascetiJSxACO8TLRaUAGsYKQlKhKJR4AxrNWAO6oJJN9AcMkQOgiLlKXChsxmCC8EswDlu0kWazmYboEAAX1xw8rMAAYtAYBQ0Fg8EQyBegA

(Only applicable for extension issues) IDE Information

No response

Activity

  1. changed the title [-]`missing-override-decorator` false positive when using property setters of base class[/-] [+]`missing-override-decorator` false positive when assigning to inherited property[/+] on May 14, 2026
  2. self-assigned this
    on May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions