Skip to content

[red-knot] support type[Any] #14546

@carljm

Description

@carljm

The Python type system supports the type[Any] type as a special case of the type[...] special form. This is a gradual type representing some unknown class and all of its subclasses.

Once we have fixed #14544, we should also support type[Any]. This will require updating our representation of SubclassOfType to an enum, so it can store either a Class or just represent type[Any]. This will also require checking each place we handle Type::SubclassOf and updating it to handle the gradual variant correctly.

We should also infer type[Any] from an annotation that just uses bare type, e.g. x: type = ....

Metadata

Metadata

Assignees

Labels

tyMulti-file analysis & type inference

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions