Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[red-knot] Avoid panic for generic type aliases (astral-sh#14312)
## Summary This avoids a panic inside `TypeInferenceBuilder::infer_type_parameters` when encountering generic type aliases: ```py type ListOrSet[T] = list[T] | set[T] ``` To fix this properly, we would have to treat type aliases as being their own annotation scope [1]. The left hand side is a definition for the type parameter `T` which is being used in the special annotation scope on the right hand side. Similar to how it works for generic functions and classes. [1] https://docs.python.org/3/reference/compound_stmts.html#generic-type-aliases closes astral-sh#14307 ## Test Plan Added new example to the corpus.
- Loading branch information