Skip to content

[red-knot] Store the value type for name expressions in store context. #17122

@MichaReiser

Description

@MichaReiser

Given:

class Name:
    ...

class Foo:
    name: Name

Red Knot stores Type::Never for the ExprName node declaring the attribute name. In pseudo code:

class Name:
    ...

class Foo:
    reveal_type(name): Name

Storing Type::Never has the downside that goto type definition and other LSP operations don't work as expected (unless we handle these expressions differently).

We should consider storing the new value type for the ExprName node instead.

Metadata

Metadata

Assignees

Labels

tyMulti-file analysis & type inference

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions