Skip to content

Annotation-only class attribute unresolvable in the same class body #4411

Description

@yangdanny97

Describe the Bug

Found when checking typeshed

class R: ...

class Doc:
    x: R
    y = x                # false positive: Could not find name `x`

class Doc2:
    x: R = R()
    y = x                # OK

Sandbox Link

https://pyrefly.org/sandbox/?project=v2.pVSxCoMwEP2VAwenGujo2rFDi7ODqVoNSCImKfr3fUkMVGxdKgjxvLzL5b17vywzjEqRU5ZlpaMW7zpzqs7dl7uHOacirhecb47SiE9CTw7R0Ki0MAJivig7NIQO4RoSCzBO1VztSpw3NQBdgPvjSrfrnpKE7iFAa3cwI3DZWVgeOMpKmcDtWuqNGXXOWNyupo61kjWq1myzg5FTH39x4Y10C0fKS0gD9h8tpEEK6ZESUicEZABgELUwJy7dtaQeG_F2_h6P-cNywpQKCVxuzCQe1vjSMc9Kq_EvnOSjnpUYo7r3vcfoocDe

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions