ruff
787bcd1c - [red-knot] Handle explicit class specialization in type expressions (#17434)

Commit
153 days ago
[red-knot] Handle explicit class specialization in type expressions (#17434) You can now use subscript expressions in a type expression to explicitly specialize generic classes, just like you could already do in value expressions. This still does not implement bidirectional checking, so a type annotation on an assignment does not influence how we infer a specialization for a (not explicitly specialized) constructor call. You might get an `invalid-assignment` error if (a) we cannot infer a class specialization from the constructor call (in which case you end up e.g. trying to assign `C[Unknown]` to `C[int]`) or if (b) we can infer a specialization, but it doesn't match the annotation. Closes https://github.com/astral-sh/ruff/issues/17432
Author
Parents
Loading