Skip to content

Goto-definition doesn't work when accessing type attributes on class objects #2424

@AlexWaygood

Description

@AlexWaygood

For this snippet:

class Foo: ...

Foo.__dictoffset__

Ty correctly infers that the type of the __dictoffset__ attribute is an int. However, goto-definition doesn't take me to the definition of this attribute (which is found at https://github.com/astral-sh/ruff/blob/a0f2cd0ded976511b1746c56d289c0cdb2320098/crates/ty_vendored/vendor/typeshed/stdlib/builtins.pyi#L261-L262 -- all class objects are instances of type, so all attributes defined on builtins.type are available on a class object).

Metadata

Metadata

Assignees

No one assigned

    Labels

    serverRelated to the LSP server

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions