Delete type-ignore node

<!--
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

This PR removes the type ignore node from the AST because our parser doesn't support it, and just having it around is confusing.

<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan

`cargo build`

<!-- How was it tested? -->
This commit is contained in:
Micha Reiser 2023-08-01 12:34:50 +02:00 committed by GitHub
parent c6986ac95d
commit 4ad5903ef6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 13 additions and 391 deletions

View file

@ -5,12 +5,12 @@ use insta::assert_snapshot;
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::visitor::preorder::{
walk_alias, walk_arg, walk_arguments, walk_comprehension, walk_except_handler, walk_expr,
walk_keyword, walk_match_case, walk_module, walk_pattern, walk_stmt, walk_type_ignore,
walk_type_param, walk_with_item, PreorderVisitor,
walk_keyword, walk_match_case, walk_module, walk_pattern, walk_stmt, walk_type_param,
walk_with_item, PreorderVisitor,
};
use ruff_python_ast::{
Alias, Arg, Arguments, BoolOp, CmpOp, Comprehension, Constant, ExceptHandler, Expr, Keyword,
MatchCase, Mod, Operator, Pattern, Stmt, TypeIgnore, TypeParam, UnaryOp, WithItem,
MatchCase, Mod, Operator, Pattern, Stmt, TypeParam, UnaryOp, WithItem,
};
use ruff_python_parser::lexer::lex;
use ruff_python_parser::{parse_tokens, Mode};
@ -273,12 +273,6 @@ impl PreorderVisitor<'_> for RecordVisitor {
self.exit_node();
}
fn visit_type_ignore(&mut self, type_ignore: &TypeIgnore) {
self.enter_node(type_ignore);
walk_type_ignore(self, type_ignore);
self.exit_node();
}
fn visit_type_param(&mut self, type_param: &TypeParam) {
self.enter_node(type_param);
walk_type_param(self, type_param);

View file

@ -144,11 +144,7 @@ where
V: Visitor<'a> + ?Sized,
{
match module {
ast::Mod::Module(ast::ModModule {
body,
range: _,
type_ignores: _,
}) => {
ast::Mod::Module(ast::ModModule { body, range: _ }) => {
visitor.visit_body(body);
}
ast::Mod::Interactive(ast::ModInteractive { body, range: _ }) => {