Skip to content

cached_property overriding unannotated class variable #3062

Description

@grievejia

Describe the Bug

Minmal repro:

from functools import cached_property

class BaseDatabaseFeatures2:
    can_introspect_fk = True
    update_can_self_select = True


class MySQLFeatures(BaseDatabaseFeatures2):
    @cached_property
    def can_introspect_fk(self):  # FP: property but BaseDatabaseFeatures2.can_introspect_fk is not
        return self._check()

    @cached_property
    def update_can_self_select(self):  # FP: property but parent is not
        return True

    def _check(self) -> bool:
        return False

cached_property is defined to be settable on typeshed. No other type checker wants to error on this, at least by default.

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeS4ATrgLYAEYArugMYAuuuUcdENxuSmzotULABYxMAfWLViMIaQA66VSyio4PAEJaYAEVRtU2fQDEYxxpXgAmRKrrORGaRHRtqcBe2lgAazoAXjoAFUpGGCcXRmJMYxhpUXRpOBgoMDSMmHYQ8MjotWKNLR4AWVIAZQBFABlLa1s4AAo9dKMTM3TGtht7AEpHdBc6AAFRCSlZeUU2FRGXTBgwV1SPL1wfXLZ-AJb0zKHnAGI6cwAFRDo5XAUlOmxGYXbDY1MLKz7mu0IU9083l8u0CvB46FwbBio2ctm%2BI0OYEIyUkLH2A1U0PGk0kMlu93mWOWqziCTYSX%2BiOysHYBwyYGOdDOl2u%2BLmpEezxuqFsnjBdAhUMWMLocJsIwiUUxwroxLoKNy%2B0RAzoAFoAHyPThQYYi2EweHnVDcGAgAA0IGe0DgJHIiBAZwAqmxoBB5gxmOwILh0HBpXKwIIaMZpOhGDRsIoWvhrhsVRq6HAvLqXGLKCMwMoQAA5cORyjXYD4AC%2BWdU5pAZFsYCgpEIHBoUAoZwupGrtcTGBwBBEPsgAHMbMZvehCKozlUYDA6OI2GxiHBEAB6JdVla1wiCftLmDoJeYXAsOBLlh9iCDyjDn1LhiCOioABuqGgplgvfQA6HLp9dDu399Y7oGQbDiD6qoPoocAjvkWYAMyEAAjHYZboCAxYWmILoQeY0CmvaaBYHgRBkGhQA

(Only applicable for extension issues) IDE Information

No response

Activity

  1. added theissue type on Apr 7, 2026
  2. added
    usabilityUsability & readiness issues identified with running Pyrefly on top OSS projects
    on Apr 7, 2026
  3. asukaminato0721 commented on Jun 30, 2026

    @asukaminato0721
    Collaborator

    #claim

  4. github-actions commented on Jun 30, 2026

    @github-actions

    @asukaminato0721 you've claimed this issue — it's now assigned to you. Thanks for picking it up! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

has-open-prtypecheckingusabilityUsability & readiness issues identified with running Pyrefly on top OSS projects

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions