-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement visitation of type aliases and parameters (#5927)
<!-- 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? --> Part of #5062 Requires astral-sh/RustPython-Parser#32 Adds visitation of type alias statements and type parameters in class and function definitions. Duplicates tests for `PreorderVisitor` into `Visitor` with new snapshots. Testing required node implementations for the `TypeParam` enum, which is a chunk of the diff and the reason we need `Ranged` implementations in astral-sh/RustPython-Parser#32. ## Test Plan <!-- How was it tested? --> Adds unit tests with snapshots.
- Loading branch information
Showing
18 changed files
with
837 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...ruff_python_ast/src/snapshots/ruff_python_ast__visitor__tests__class_type_parameters.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
source: crates/ruff_python_ast/src/visitor.rs | ||
expression: trace | ||
--- | ||
- StmtClassDef | ||
- TypeParamTypeVar | ||
- ExprName | ||
- TypeParamTypeVar | ||
- TypeParamTypeVarTuple | ||
- TypeParamParamSpec | ||
- StmtExpr | ||
- ExprConstant | ||
|
12 changes: 12 additions & 0 deletions
12
crates/ruff_python_ast/src/snapshots/ruff_python_ast__visitor__tests__compare.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
source: crates/ruff_python_ast/src/visitor.rs | ||
expression: trace | ||
--- | ||
- StmtExpr | ||
- ExprCompare | ||
- ExprConstant | ||
- Lt | ||
- Lt | ||
- ExprName | ||
- ExprConstant | ||
|
12 changes: 12 additions & 0 deletions
12
crates/ruff_python_ast/src/snapshots/ruff_python_ast__visitor__tests__decorators.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
source: crates/ruff_python_ast/src/visitor.rs | ||
expression: trace | ||
--- | ||
- StmtFunctionDef | ||
- ExprName | ||
- Arguments | ||
- StmtPass | ||
- StmtClassDef | ||
- ExprName | ||
- StmtPass | ||
|
Oops, something went wrong.