Skip to content

Commit

Permalink
Implement visitation of type alias statements in the checker
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Jul 26, 2023
1 parent e923e3f commit fcd5e14
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions crates/ruff/src/checkers/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,20 @@ where

self.visit_body(body);
}
Stmt::TypeAlias(ast::StmtTypeAlias {
range: _range,
name,
type_params,
value,
}) => {
self.semantic.push_scope(ScopeKind::Type);
for type_param in type_params {
self.visit_type_param(type_param);
}
self.visit_expr(value);
self.semantic.pop_scope();
self.visit_expr(name);
}
Stmt::Try(ast::StmtTry {
body,
handlers,
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_python_ast/src/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ pub fn walk_stmt<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, stmt: &'a Stmt) {
type_params,
value,
}) => {
visitor.visit_expr(value);
for type_param in type_params {
visitor.visit_type_param(type_param);
}
visitor.visit_expr(value);
visitor.visit_expr(name);
}
Stmt::Assign(ast::StmtAssign { targets, value, .. }) => {
Expand Down

0 comments on commit fcd5e14

Please sign in to comment.