mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 20:42:10 +00:00
Add semantic analysis of type aliases and parameters (#6109)
Requires https://github.com/astral-sh/RustPython-Parser/pull/42 Related https://github.com/PyCQA/pyflakes/pull/778 [PEP-695](https://peps.python.org/pep-0695) Part of #5062 <!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> Adds a scope for type parameters, a type parameter binding kind, and checker visitation of type parameters in type alias statements, function definitions, and class definitions. A few changes were necessary to ensure correctness following the insertion of a new scope between function and class scopes and their parent. ## Test Plan <!-- How was it tested? --> Undefined name snapshots. Unused type parameter rule will be added as follow-up.
This commit is contained in:
parent
134d447d4c
commit
047c211837
11 changed files with 405 additions and 18 deletions
|
@ -181,6 +181,7 @@ pub enum ScopeKind<'a> {
|
|||
AsyncFunction(&'a ast::StmtAsyncFunctionDef),
|
||||
Generator,
|
||||
Module,
|
||||
Type,
|
||||
Lambda(&'a ast::ExprLambda),
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue