mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-13 05:47:06 +00:00
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:
parent
c6986ac95d
commit
4ad5903ef6
12 changed files with 13 additions and 391 deletions
|
@ -20,7 +20,6 @@ pub enum Mod {
|
|||
pub struct ModModule {
|
||||
pub range: TextRange,
|
||||
pub body: Vec<Stmt>,
|
||||
pub type_ignores: Vec<TypeIgnore>,
|
||||
}
|
||||
|
||||
impl From<ModModule> for Mod {
|
||||
|
@ -2037,26 +2036,6 @@ impl From<PatternMatchOr> for Pattern {
|
|||
}
|
||||
}
|
||||
|
||||
/// See also [type_ignore](https://docs.python.org/3/library/ast.html#ast.type_ignore)
|
||||
#[derive(Clone, Debug, PartialEq, is_macro::Is)]
|
||||
pub enum TypeIgnore {
|
||||
TypeIgnore(TypeIgnoreTypeIgnore),
|
||||
}
|
||||
|
||||
/// See also [TypeIgnore](https://docs.python.org/3/library/ast.html#ast.TypeIgnore)
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct TypeIgnoreTypeIgnore {
|
||||
pub range: TextRange,
|
||||
pub lineno: Int,
|
||||
pub tag: String,
|
||||
}
|
||||
|
||||
impl From<TypeIgnoreTypeIgnore> for TypeIgnore {
|
||||
fn from(payload: TypeIgnoreTypeIgnore) -> Self {
|
||||
TypeIgnore::TypeIgnore(payload)
|
||||
}
|
||||
}
|
||||
|
||||
/// See also [type_param](https://docs.python.org/3/library/ast.html#ast.type_param)
|
||||
#[derive(Clone, Debug, PartialEq, is_macro::Is)]
|
||||
pub enum TypeParam {
|
||||
|
@ -2993,18 +2972,6 @@ impl Ranged for crate::Pattern {
|
|||
}
|
||||
}
|
||||
|
||||
impl Ranged for crate::nodes::TypeIgnoreTypeIgnore {
|
||||
fn range(&self) -> TextRange {
|
||||
self.range
|
||||
}
|
||||
}
|
||||
impl Ranged for crate::TypeIgnore {
|
||||
fn range(&self) -> TextRange {
|
||||
match self {
|
||||
Self::TypeIgnore(node) => node.range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Ranged for crate::nodes::TypeParamTypeVar {
|
||||
fn range(&self) -> TextRange {
|
||||
self.range
|
||||
|
@ -3055,5 +3022,5 @@ mod size_assertions {
|
|||
assert_eq_size!(Expr, [u8; 80]);
|
||||
assert_eq_size!(Constant, [u8; 32]);
|
||||
assert_eq_size!(Pattern, [u8; 96]);
|
||||
assert_eq_size!(Mod, [u8; 64]);
|
||||
assert_eq_size!(Mod, [u8; 48]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue