-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement visitation of type aliases and parameters #5927
Conversation
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinux
Windows
|
Cargo.toml
Outdated
ruff_text_size = { git = "https://github.com/astral-sh/RustPython-Parser.git", rev = "86f4dc8869bbab5786a39cc6d1e6083c12d65e6e" } | ||
rustpython-ast = { git = "https://github.com/astral-sh/RustPython-Parser.git", rev = "86f4dc8869bbab5786a39cc6d1e6083c12d65e6e" , default-features = false, features = ["num-bigint"]} | ||
rustpython-format = { git = "https://github.com/astral-sh/RustPython-Parser.git", rev = "86f4dc8869bbab5786a39cc6d1e6083c12d65e6e", default-features = false, features = ["num-bigint"] } | ||
rustpython-literal = { git = "https://github.com/astral-sh/RustPython-Parser.git", rev = "86f4dc8869bbab5786a39cc6d1e6083c12d65e6e", default-features = false } | ||
rustpython-parser = { git = "https://github.com/astral-sh/RustPython-Parser.git", rev = "86f4dc8869bbab5786a39cc6d1e6083c12d65e6e" , default-features = false, features = ["full-lexer", "num-bigint"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pin is temporary and will need to be amended on merge of astral-sh/RustPython-Parser#32
@@ -0,0 +1,13 @@ | |||
--- | |||
source: crates/ruff_python_ast/src/visitor.rs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
relevant test
@@ -0,0 +1,14 @@ | |||
--- | |||
source: crates/ruff_python_ast/src/visitor.rs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
relevant test
@@ -0,0 +1,12 @@ | |||
--- | |||
source: crates/ruff_python_ast/src/visitor.rs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of these snapshots are new coverage of previous behavior with tests duplicated from the pre-order visitor.
@@ -0,0 +1,15 @@ | |||
--- | |||
source: crates/ruff_python_ast/src/visitor.rs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
relevant test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Can you search for all Visitor
(preorder or normal) implementations and add the overrides for visit_type_params
for visitors that must visit all nodes or do you plan to do this as separate PRS?
For example, it's important for the correctness of CommentsVisitor
to override every node visiting function:
impl<'ast> PreorderVisitor<'ast> for CommentsVisitor<'ast> { |
903a3a6
to
e9cac63
Compare
I'll do this here! |
e9cac63
to
f560538
Compare
f560538
to
c8f962a
Compare
Summary
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
intoVisitor
with new snapshots. Testing required node implementations for theTypeParam
enum, which is a chunk of the diff and the reason we needRanged
implementations in astral-sh/RustPython-Parser#32.Test Plan
Adds unit tests with snapshots.