Add a TypeParams node to the AST (#6261)

## Summary

Similar to #6259, this PR adds a `TypeParams` node to the AST, to
capture the list of type parameters with their surrounding brackets.

If a statement lacks type parameters, the `type_params` field will be
`None`.
This commit is contained in:
Charlie Marsh 2023-08-02 10:12:45 -04:00 committed by GitHub
parent 981e64f82b
commit b095b7204b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 1104 additions and 866 deletions

View file

@ -1010,14 +1010,14 @@ WithItem<Goal>: ast::WithItem = {
};
FuncDef: ast::Stmt = {
<location:@L> <decorator_list:Decorator*> <is_async:"async"?> "def" <name:Identifier> <type_params:TypeParamList?> <args:Parameters> <r:("->" <Test<"all">>)?> ":" <body:Suite> => {
<location:@L> <decorator_list:Decorator*> <is_async:"async"?> "def" <name:Identifier> <type_params:TypeParams?> <args:Parameters> <r:("->" <Test<"all">>)?> ":" <body:Suite> => {
let args = Box::new(args);
let returns = r.map(Box::new);
let end_location = body.last().unwrap().end();
if is_async.is_some() {
ast::StmtAsyncFunctionDef { name, parameters:args, body, decorator_list, returns, type_params: type_params.unwrap_or_default(), range: (location..end_location).into() }.into()
ast::StmtAsyncFunctionDef { name, parameters:args, body, decorator_list, returns, type_params, range: (location..end_location).into() }.into()
} else {
ast::StmtFunctionDef { name, parameters:args, body, decorator_list, returns, type_params: type_params.unwrap_or_default(), range: (location..end_location).into() }.into()
ast::StmtFunctionDef { name, parameters:args, body, decorator_list, returns, type_params, range: (location..end_location).into() }.into()
}
},
};
@ -1029,12 +1029,12 @@ TypeAliasName: ast::Expr = {
}
TypeAliasStatement: ast::Stmt = {
<location:@L> "type" <name:TypeAliasName> <type_params:TypeParamList?> "=" <value:Test<"all">> <end_location:@R> => {
<location:@L> "type" <name:TypeAliasName> <type_params:TypeParams?> "=" <value:Test<"all">> <end_location:@R> => {
ast::Stmt::TypeAlias(
ast::StmtTypeAlias {
name: Box::new(name),
value: Box::new(value),
type_params: type_params.unwrap_or_default(),
type_params,
range: (location..end_location).into()
},
)
@ -1194,7 +1194,7 @@ KwargParameter<ParameterType>: Option<Box<ast::Parameter>> = {
};
ClassDef: ast::Stmt = {
<location:@L> <decorator_list:Decorator*> "class" <name:Identifier> <type_params:TypeParamList?> <arguments:Arguments?> ":" <body:Suite> => {
<location:@L> <decorator_list:Decorator*> "class" <name:Identifier> <type_params:TypeParams?> <arguments:Arguments?> ":" <body:Suite> => {
let end_location = body.last().unwrap().end();
ast::Stmt::ClassDef(
ast::StmtClassDef {
@ -1202,17 +1202,19 @@ ClassDef: ast::Stmt = {
arguments,
body,
decorator_list,
type_params: type_params.unwrap_or_default(),
type_params,
range: (location..end_location).into()
},
)
},
};
TypeParamList: Vec<ast::TypeParam> = {
TypeParams: ast::TypeParams = {
<location:@L> "[" <vars:OneOrMore<TypeParam>> ","? "]" <end_location:@R> => {
vars
ast::TypeParams {
type_params: vars,
range: (location..end_location).into()
}
}
};

View file

@ -1,5 +1,5 @@
// auto-generated: "lalrpop 0.20.0"
// sha3: 3c5459b3b4420f13663b68f1bf78d526b5e5b0249d7877fe70dad50319098ef9
// sha3: aadf067e37a9f39d450f1403b759a9659c60e697758ddd2b8c2b5fa2d0d73672
use num_bigint::BigInt;
use ruff_text_size::TextSize;
use ruff_python_ast::{self as ast, Ranged, MagicKind};
@ -134,8 +134,9 @@ mod __parse__Top {
Variant88(Vec<ast::Stmt>),
Variant89(ast::Mod),
Variant90(ast::TypeParam),
Variant91(core::option::Option<Vec<ast::TypeParam>>),
Variant92(ast::UnaryOp),
Variant91(ast::TypeParams),
Variant92(core::option::Option<ast::TypeParams>),
Variant93(ast::UnaryOp),
}
const __ACTION: &[i16] = &[
// State 0
@ -18269,13 +18270,23 @@ mod __parse__Top {
_ => __symbol_type_mismatch()
}
}
fn __pop_Variant92<
fn __pop_Variant91<
>(
__symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)>
) -> (TextSize, ast::TypeParams, TextSize)
{
match __symbols.pop() {
Some((__l, __Symbol::Variant91(__v), __r)) => (__l, __v, __r),
_ => __symbol_type_mismatch()
}
}
fn __pop_Variant93<
>(
__symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)>
) -> (TextSize, ast::UnaryOp, TextSize)
{
match __symbols.pop() {
Some((__l, __Symbol::Variant92(__v), __r)) => (__l, __v, __r),
Some((__l, __Symbol::Variant93(__v), __r)) => (__l, __v, __r),
_ => __symbol_type_mismatch()
}
}
@ -18369,16 +18380,6 @@ mod __parse__Top {
_ => __symbol_type_mismatch()
}
}
fn __pop_Variant91<
>(
__symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)>
) -> (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize)
{
match __symbols.pop() {
Some((__l, __Symbol::Variant91(__v), __r)) => (__l, __v, __r),
_ => __symbol_type_mismatch()
}
}
fn __pop_Variant40<
>(
__symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)>
@ -18459,6 +18460,16 @@ mod __parse__Top {
_ => __symbol_type_mismatch()
}
}
fn __pop_Variant92<
>(
__symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)>
) -> (TextSize, core::option::Option<ast::TypeParams>, TextSize)
{
match __symbols.pop() {
Some((__l, __Symbol::Variant92(__v), __r)) => (__l, __v, __r),
_ => __symbol_type_mismatch()
}
}
fn __pop_Variant7<
>(
__symbols: &mut alloc::vec::Vec<(TextSize,__Symbol<>,TextSize)>
@ -22026,12 +22037,12 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// ClassDef = "class", Identifier, TypeParamList, Arguments, ":", Suite => ActionFn(1712);
// ClassDef = "class", Identifier, TypeParams, Arguments, ":", Suite => ActionFn(1712);
assert!(__symbols.len() >= 6);
let __sym5 = __pop_Variant24(__symbols);
let __sym4 = __pop_Variant0(__symbols);
let __sym3 = __pop_Variant49(__symbols);
let __sym2 = __pop_Variant81(__symbols);
let __sym2 = __pop_Variant91(__symbols);
let __sym1 = __pop_Variant22(__symbols);
let __sym0 = __pop_Variant0(__symbols);
let __start = __sym0.0;
@ -22069,12 +22080,12 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// ClassDef = Decorator+, "class", Identifier, TypeParamList, Arguments, ":", Suite => ActionFn(1714);
// ClassDef = Decorator+, "class", Identifier, TypeParams, Arguments, ":", Suite => ActionFn(1714);
assert!(__symbols.len() >= 7);
let __sym6 = __pop_Variant24(__symbols);
let __sym5 = __pop_Variant0(__symbols);
let __sym4 = __pop_Variant49(__symbols);
let __sym3 = __pop_Variant81(__symbols);
let __sym3 = __pop_Variant91(__symbols);
let __sym2 = __pop_Variant22(__symbols);
let __sym1 = __pop_Variant0(__symbols);
let __sym0 = __pop_Variant58(__symbols);
@ -22114,11 +22125,11 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// ClassDef = "class", Identifier, TypeParamList, ":", Suite => ActionFn(1716);
// ClassDef = "class", Identifier, TypeParams, ":", Suite => ActionFn(1716);
assert!(__symbols.len() >= 5);
let __sym4 = __pop_Variant24(__symbols);
let __sym3 = __pop_Variant0(__symbols);
let __sym2 = __pop_Variant81(__symbols);
let __sym2 = __pop_Variant91(__symbols);
let __sym1 = __pop_Variant22(__symbols);
let __sym0 = __pop_Variant0(__symbols);
let __start = __sym0.0;
@ -22155,11 +22166,11 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// ClassDef = Decorator+, "class", Identifier, TypeParamList, ":", Suite => ActionFn(1718);
// ClassDef = Decorator+, "class", Identifier, TypeParams, ":", Suite => ActionFn(1718);
assert!(__symbols.len() >= 6);
let __sym5 = __pop_Variant24(__symbols);
let __sym4 = __pop_Variant0(__symbols);
let __sym3 = __pop_Variant81(__symbols);
let __sym3 = __pop_Variant91(__symbols);
let __sym2 = __pop_Variant22(__symbols);
let __sym1 = __pop_Variant0(__symbols);
let __sym0 = __pop_Variant58(__symbols);
@ -24076,7 +24087,7 @@ mod __parse__Top {
// Factor<"all"> = UnaryOp, Factor<"all"> => ActionFn(1278);
assert!(__symbols.len() >= 2);
let __sym1 = __pop_Variant14(__symbols);
let __sym0 = __pop_Variant92(__symbols);
let __sym0 = __pop_Variant93(__symbols);
let __start = __sym0.0;
let __end = __sym1.2;
let __nt = super::__action1278::<>(mode, __sym0, __sym1);
@ -24110,7 +24121,7 @@ mod __parse__Top {
// Factor<"no-withitems"> = UnaryOp, Factor<"all"> => ActionFn(1279);
assert!(__symbols.len() >= 2);
let __sym1 = __pop_Variant14(__symbols);
let __sym0 = __pop_Variant92(__symbols);
let __sym0 = __pop_Variant93(__symbols);
let __start = __sym0.0;
let __end = __sym1.2;
let __nt = super::__action1279::<>(mode, __sym0, __sym1);
@ -24335,14 +24346,14 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// FuncDef = "async", "def", Identifier, TypeParamList, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1720);
// FuncDef = "async", "def", Identifier, TypeParams, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1720);
assert!(__symbols.len() >= 9);
let __sym8 = __pop_Variant24(__symbols);
let __sym7 = __pop_Variant0(__symbols);
let __sym6 = __pop_Variant14(__symbols);
let __sym5 = __pop_Variant0(__symbols);
let __sym4 = __pop_Variant45(__symbols);
let __sym3 = __pop_Variant81(__symbols);
let __sym3 = __pop_Variant91(__symbols);
let __sym2 = __pop_Variant22(__symbols);
let __sym1 = __pop_Variant0(__symbols);
let __sym0 = __pop_Variant0(__symbols);
@ -24384,14 +24395,14 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// FuncDef = Decorator+, "async", "def", Identifier, TypeParamList, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1722);
// FuncDef = Decorator+, "async", "def", Identifier, TypeParams, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1722);
assert!(__symbols.len() >= 10);
let __sym9 = __pop_Variant24(__symbols);
let __sym8 = __pop_Variant0(__symbols);
let __sym7 = __pop_Variant14(__symbols);
let __sym6 = __pop_Variant0(__symbols);
let __sym5 = __pop_Variant45(__symbols);
let __sym4 = __pop_Variant81(__symbols);
let __sym4 = __pop_Variant91(__symbols);
let __sym3 = __pop_Variant22(__symbols);
let __sym2 = __pop_Variant0(__symbols);
let __sym1 = __pop_Variant0(__symbols);
@ -24435,12 +24446,12 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// FuncDef = "async", "def", Identifier, TypeParamList, Parameters, ":", Suite => ActionFn(1724);
// FuncDef = "async", "def", Identifier, TypeParams, Parameters, ":", Suite => ActionFn(1724);
assert!(__symbols.len() >= 7);
let __sym6 = __pop_Variant24(__symbols);
let __sym5 = __pop_Variant0(__symbols);
let __sym4 = __pop_Variant45(__symbols);
let __sym3 = __pop_Variant81(__symbols);
let __sym3 = __pop_Variant91(__symbols);
let __sym2 = __pop_Variant22(__symbols);
let __sym1 = __pop_Variant0(__symbols);
let __sym0 = __pop_Variant0(__symbols);
@ -24480,12 +24491,12 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// FuncDef = Decorator+, "async", "def", Identifier, TypeParamList, Parameters, ":", Suite => ActionFn(1726);
// FuncDef = Decorator+, "async", "def", Identifier, TypeParams, Parameters, ":", Suite => ActionFn(1726);
assert!(__symbols.len() >= 8);
let __sym7 = __pop_Variant24(__symbols);
let __sym6 = __pop_Variant0(__symbols);
let __sym5 = __pop_Variant45(__symbols);
let __sym4 = __pop_Variant81(__symbols);
let __sym4 = __pop_Variant91(__symbols);
let __sym3 = __pop_Variant22(__symbols);
let __sym2 = __pop_Variant0(__symbols);
let __sym1 = __pop_Variant0(__symbols);
@ -24527,14 +24538,14 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// FuncDef = "def", Identifier, TypeParamList, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1728);
// FuncDef = "def", Identifier, TypeParams, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1728);
assert!(__symbols.len() >= 8);
let __sym7 = __pop_Variant24(__symbols);
let __sym6 = __pop_Variant0(__symbols);
let __sym5 = __pop_Variant14(__symbols);
let __sym4 = __pop_Variant0(__symbols);
let __sym3 = __pop_Variant45(__symbols);
let __sym2 = __pop_Variant81(__symbols);
let __sym2 = __pop_Variant91(__symbols);
let __sym1 = __pop_Variant22(__symbols);
let __sym0 = __pop_Variant0(__symbols);
let __start = __sym0.0;
@ -24574,14 +24585,14 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// FuncDef = Decorator+, "def", Identifier, TypeParamList, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1730);
// FuncDef = Decorator+, "def", Identifier, TypeParams, Parameters, "->", Test<"all">, ":", Suite => ActionFn(1730);
assert!(__symbols.len() >= 9);
let __sym8 = __pop_Variant24(__symbols);
let __sym7 = __pop_Variant0(__symbols);
let __sym6 = __pop_Variant14(__symbols);
let __sym5 = __pop_Variant0(__symbols);
let __sym4 = __pop_Variant45(__symbols);
let __sym3 = __pop_Variant81(__symbols);
let __sym3 = __pop_Variant91(__symbols);
let __sym2 = __pop_Variant22(__symbols);
let __sym1 = __pop_Variant0(__symbols);
let __sym0 = __pop_Variant58(__symbols);
@ -24623,12 +24634,12 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// FuncDef = "def", Identifier, TypeParamList, Parameters, ":", Suite => ActionFn(1732);
// FuncDef = "def", Identifier, TypeParams, Parameters, ":", Suite => ActionFn(1732);
assert!(__symbols.len() >= 6);
let __sym5 = __pop_Variant24(__symbols);
let __sym4 = __pop_Variant0(__symbols);
let __sym3 = __pop_Variant45(__symbols);
let __sym2 = __pop_Variant81(__symbols);
let __sym2 = __pop_Variant91(__symbols);
let __sym1 = __pop_Variant22(__symbols);
let __sym0 = __pop_Variant0(__symbols);
let __start = __sym0.0;
@ -24666,12 +24677,12 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// FuncDef = Decorator+, "def", Identifier, TypeParamList, Parameters, ":", Suite => ActionFn(1734);
// FuncDef = Decorator+, "def", Identifier, TypeParams, Parameters, ":", Suite => ActionFn(1734);
assert!(__symbols.len() >= 7);
let __sym6 = __pop_Variant24(__symbols);
let __sym5 = __pop_Variant0(__symbols);
let __sym4 = __pop_Variant45(__symbols);
let __sym3 = __pop_Variant81(__symbols);
let __sym3 = __pop_Variant91(__symbols);
let __sym2 = __pop_Variant22(__symbols);
let __sym1 = __pop_Variant0(__symbols);
let __sym0 = __pop_Variant58(__symbols);
@ -29792,11 +29803,11 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// TypeAliasStatement = "type", TypeAliasName, TypeParamList, "=", Test<"all"> => ActionFn(1736);
// TypeAliasStatement = "type", TypeAliasName, TypeParams, "=", Test<"all"> => ActionFn(1736);
assert!(__symbols.len() >= 5);
let __sym4 = __pop_Variant14(__symbols);
let __sym3 = __pop_Variant0(__symbols);
let __sym2 = __pop_Variant81(__symbols);
let __sym2 = __pop_Variant91(__symbols);
let __sym1 = __pop_Variant14(__symbols);
let __sym0 = __pop_Variant0(__symbols);
let __start = __sym0.0;
@ -29904,7 +29915,7 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// TypeParamList = "[", OneOrMore<TypeParam>, ",", "]" => ActionFn(1462);
// TypeParams = "[", OneOrMore<TypeParam>, ",", "]" => ActionFn(1462);
assert!(__symbols.len() >= 4);
let __sym3 = __pop_Variant0(__symbols);
let __sym2 = __pop_Variant0(__symbols);
@ -29913,7 +29924,7 @@ mod __parse__Top {
let __start = __sym0.0;
let __end = __sym3.2;
let __nt = super::__action1462::<>(mode, __sym0, __sym1, __sym2, __sym3);
__symbols.push((__start, __Symbol::Variant81(__nt), __end));
__symbols.push((__start, __Symbol::Variant91(__nt), __end));
(4, 260)
}
pub(crate) fn __reduce876<
@ -29924,7 +29935,7 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// TypeParamList = "[", OneOrMore<TypeParam>, "]" => ActionFn(1463);
// TypeParams = "[", OneOrMore<TypeParam>, "]" => ActionFn(1463);
assert!(__symbols.len() >= 3);
let __sym2 = __pop_Variant0(__symbols);
let __sym1 = __pop_Variant81(__symbols);
@ -29932,7 +29943,7 @@ mod __parse__Top {
let __start = __sym0.0;
let __end = __sym2.2;
let __nt = super::__action1463::<>(mode, __sym0, __sym1, __sym2);
__symbols.push((__start, __Symbol::Variant81(__nt), __end));
__symbols.push((__start, __Symbol::Variant91(__nt), __end));
(3, 260)
}
pub(crate) fn __reduce877<
@ -29943,12 +29954,12 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// TypeParamList? = TypeParamList => ActionFn(284);
let __sym0 = __pop_Variant81(__symbols);
// TypeParams? = TypeParams => ActionFn(284);
let __sym0 = __pop_Variant91(__symbols);
let __start = __sym0.0;
let __end = __sym0.2;
let __nt = super::__action284::<>(mode, __sym0);
__symbols.push((__start, __Symbol::Variant91(__nt), __end));
__symbols.push((__start, __Symbol::Variant92(__nt), __end));
(1, 261)
}
pub(crate) fn __reduce878<
@ -29959,11 +29970,11 @@ mod __parse__Top {
_: core::marker::PhantomData<()>,
) -> (usize, usize)
{
// TypeParamList? = => ActionFn(285);
// TypeParams? = => ActionFn(285);
let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default();
let __end = __start.clone();
let __nt = super::__action285::<>(mode, &__start, &__end);
__symbols.push((__start, __Symbol::Variant91(__nt), __end));
__symbols.push((__start, __Symbol::Variant92(__nt), __end));
(0, 261)
}
pub(crate) fn __reduce879<
@ -30014,7 +30025,7 @@ mod __parse__Top {
let __start = __sym0.0;
let __end = __sym0.2;
let __nt = super::__action201::<>(mode, __sym0);
__symbols.push((__start, __Symbol::Variant92(__nt), __end));
__symbols.push((__start, __Symbol::Variant93(__nt), __end));
(1, 263)
}
pub(crate) fn __reduce882<
@ -30030,7 +30041,7 @@ mod __parse__Top {
let __start = __sym0.0;
let __end = __sym0.2;
let __nt = super::__action202::<>(mode, __sym0);
__symbols.push((__start, __Symbol::Variant92(__nt), __end));
__symbols.push((__start, __Symbol::Variant93(__nt), __end));
(1, 263)
}
pub(crate) fn __reduce883<
@ -30046,7 +30057,7 @@ mod __parse__Top {
let __start = __sym0.0;
let __end = __sym0.2;
let __nt = super::__action203::<>(mode, __sym0);
__symbols.push((__start, __Symbol::Variant92(__nt), __end));
__symbols.push((__start, __Symbol::Variant93(__nt), __end));
(1, 263)
}
pub(crate) fn __reduce884<
@ -33385,7 +33396,7 @@ fn __action161<
(_, is_async, _): (TextSize, core::option::Option<token::Tok>, TextSize),
(_, _, _): (TextSize, token::Tok, TextSize),
(_, name, _): (TextSize, ast::Identifier, TextSize),
(_, type_params, _): (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
(_, type_params, _): (TextSize, core::option::Option<ast::TypeParams>, TextSize),
(_, args, _): (TextSize, ast::Parameters, TextSize),
(_, r, _): (TextSize, core::option::Option<ast::Expr>, TextSize),
(_, _, _): (TextSize, token::Tok, TextSize),
@ -33397,9 +33408,9 @@ fn __action161<
let returns = r.map(Box::new);
let end_location = body.last().unwrap().end();
if is_async.is_some() {
ast::StmtAsyncFunctionDef { name, parameters:args, body, decorator_list, returns, type_params: type_params.unwrap_or_default(), range: (location..end_location).into() }.into()
ast::StmtAsyncFunctionDef { name, parameters:args, body, decorator_list, returns, type_params, range: (location..end_location).into() }.into()
} else {
ast::StmtFunctionDef { name, parameters:args, body, decorator_list, returns, type_params: type_params.unwrap_or_default(), range: (location..end_location).into() }.into()
ast::StmtFunctionDef { name, parameters:args, body, decorator_list, returns, type_params, range: (location..end_location).into() }.into()
}
}
}
@ -33427,7 +33438,7 @@ fn __action163<
(_, location, _): (TextSize, TextSize, TextSize),
(_, _, _): (TextSize, token::Tok, TextSize),
(_, name, _): (TextSize, ast::Expr, TextSize),
(_, type_params, _): (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
(_, type_params, _): (TextSize, core::option::Option<ast::TypeParams>, TextSize),
(_, _, _): (TextSize, token::Tok, TextSize),
(_, value, _): (TextSize, ast::Expr, TextSize),
(_, end_location, _): (TextSize, TextSize, TextSize),
@ -33438,7 +33449,7 @@ fn __action163<
ast::StmtTypeAlias {
name: Box::new(name),
value: Box::new(value),
type_params: type_params.unwrap_or_default(),
type_params,
range: (location..end_location).into()
},
)
@ -33561,7 +33572,7 @@ fn __action170<
(_, decorator_list, _): (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
(_, _, _): (TextSize, token::Tok, TextSize),
(_, name, _): (TextSize, ast::Identifier, TextSize),
(_, type_params, _): (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
(_, type_params, _): (TextSize, core::option::Option<ast::TypeParams>, TextSize),
(_, arguments, _): (TextSize, core::option::Option<ast::Arguments>, TextSize),
(_, _, _): (TextSize, token::Tok, TextSize),
(_, body, _): (TextSize, ast::Suite, TextSize),
@ -33575,7 +33586,7 @@ fn __action170<
arguments,
body,
decorator_list,
type_params: type_params.unwrap_or_default(),
type_params,
range: (location..end_location).into()
},
)
@ -33593,10 +33604,13 @@ fn __action171<
(_, _, _): (TextSize, core::option::Option<token::Tok>, TextSize),
(_, _, _): (TextSize, token::Tok, TextSize),
(_, end_location, _): (TextSize, TextSize, TextSize),
) -> Vec<ast::TypeParam>
) -> ast::TypeParams
{
{
vars
ast::TypeParams {
type_params: vars,
range: (location..end_location).into()
}
}
}
@ -35226,8 +35240,8 @@ fn __action283<
fn __action284<
>(
mode: Mode,
(_, __0, _): (TextSize, Vec<ast::TypeParam>, TextSize),
) -> core::option::Option<Vec<ast::TypeParam>>
(_, __0, _): (TextSize, ast::TypeParams, TextSize),
) -> core::option::Option<ast::TypeParams>
{
Some(__0)
}
@ -35239,7 +35253,7 @@ fn __action285<
mode: Mode,
__lookbehind: &TextSize,
__lookahead: &TextSize,
) -> core::option::Option<Vec<ast::TypeParam>>
) -> core::option::Option<ast::TypeParams>
{
None
}
@ -41093,7 +41107,7 @@ fn __action641<
__3: (TextSize, token::Tok, TextSize),
__4: (TextSize, token::Tok, TextSize),
__5: (TextSize, TextSize, TextSize),
) -> Vec<ast::TypeParam>
) -> ast::TypeParams
{
let __start0 = __3.0;
let __end0 = __3.2;
@ -41123,7 +41137,7 @@ fn __action642<
__2: (TextSize, Vec<ast::TypeParam>, TextSize),
__3: (TextSize, token::Tok, TextSize),
__4: (TextSize, TextSize, TextSize),
) -> Vec<ast::TypeParam>
) -> ast::TypeParams
{
let __start0 = __2.2;
let __end0 = __3.0;
@ -41568,7 +41582,7 @@ fn __action657<
__2: (TextSize, token::Tok, TextSize),
__3: (TextSize, token::Tok, TextSize),
__4: (TextSize, ast::Identifier, TextSize),
__5: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__5: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__6: (TextSize, ast::Parameters, TextSize),
__7: (TextSize, core::option::Option<ast::Expr>, TextSize),
__8: (TextSize, token::Tok, TextSize),
@ -41606,7 +41620,7 @@ fn __action658<
__1: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__2: (TextSize, token::Tok, TextSize),
__3: (TextSize, ast::Identifier, TextSize),
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__4: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__5: (TextSize, ast::Parameters, TextSize),
__6: (TextSize, core::option::Option<ast::Expr>, TextSize),
__7: (TextSize, token::Tok, TextSize),
@ -44422,7 +44436,7 @@ fn __action757<
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__4: (TextSize, core::option::Option<ast::Arguments>, TextSize),
__5: (TextSize, token::Tok, TextSize),
__6: (TextSize, ast::Suite, TextSize),
@ -45650,7 +45664,7 @@ fn __action798<
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, token::Tok, TextSize),
__3: (TextSize, ast::Identifier, TextSize),
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__4: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__5: (TextSize, ast::Parameters, TextSize),
__6: (TextSize, core::option::Option<ast::Expr>, TextSize),
__7: (TextSize, token::Tok, TextSize),
@ -45688,7 +45702,7 @@ fn __action799<
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__4: (TextSize, ast::Parameters, TextSize),
__5: (TextSize, core::option::Option<ast::Expr>, TextSize),
__6: (TextSize, token::Tok, TextSize),
@ -49144,7 +49158,7 @@ fn __action921<
mode: Mode,
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, ast::Expr, TextSize),
__2: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__2: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__3: (TextSize, token::Tok, TextSize),
__4: (TextSize, ast::Expr, TextSize),
__5: (TextSize, TextSize, TextSize),
@ -49261,7 +49275,7 @@ fn __action925<
__2: (TextSize, token::Tok, TextSize),
__3: (TextSize, token::Tok, TextSize),
__4: (TextSize, TextSize, TextSize),
) -> Vec<ast::TypeParam>
) -> ast::TypeParams
{
let __start0 = __0.0;
let __end0 = __0.0;
@ -49291,7 +49305,7 @@ fn __action926<
__1: (TextSize, Vec<ast::TypeParam>, TextSize),
__2: (TextSize, token::Tok, TextSize),
__3: (TextSize, TextSize, TextSize),
) -> Vec<ast::TypeParam>
) -> ast::TypeParams
{
let __start0 = __0.0;
let __end0 = __0.0;
@ -53480,7 +53494,7 @@ fn __action1073<
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, token::Tok, TextSize),
__3: (TextSize, ast::Identifier, TextSize),
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__4: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__5: (TextSize, ast::Parameters, TextSize),
__6: (TextSize, token::Tok, TextSize),
__7: (TextSize, ast::Expr, TextSize),
@ -53519,7 +53533,7 @@ fn __action1074<
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, token::Tok, TextSize),
__3: (TextSize, ast::Identifier, TextSize),
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__4: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__5: (TextSize, ast::Parameters, TextSize),
__6: (TextSize, token::Tok, TextSize),
__7: (TextSize, ast::Suite, TextSize),
@ -53555,7 +53569,7 @@ fn __action1075<
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__4: (TextSize, ast::Parameters, TextSize),
__5: (TextSize, token::Tok, TextSize),
__6: (TextSize, ast::Expr, TextSize),
@ -53592,7 +53606,7 @@ fn __action1076<
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__4: (TextSize, ast::Parameters, TextSize),
__5: (TextSize, token::Tok, TextSize),
__6: (TextSize, ast::Suite, TextSize),
@ -64235,7 +64249,7 @@ fn __action1457<
mode: Mode,
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, ast::Expr, TextSize),
__2: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__2: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__3: (TextSize, token::Tok, TextSize),
__4: (TextSize, ast::Expr, TextSize),
) -> ast::Stmt
@ -64368,7 +64382,7 @@ fn __action1462<
__1: (TextSize, Vec<ast::TypeParam>, TextSize),
__2: (TextSize, token::Tok, TextSize),
__3: (TextSize, token::Tok, TextSize),
) -> Vec<ast::TypeParam>
) -> ast::TypeParams
{
let __start0 = __3.2;
let __end0 = __3.2;
@ -64396,7 +64410,7 @@ fn __action1463<
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, Vec<ast::TypeParam>, TextSize),
__2: (TextSize, token::Tok, TextSize),
) -> Vec<ast::TypeParam>
) -> ast::TypeParams
{
let __start0 = __2.2;
let __end0 = __2.2;
@ -65355,7 +65369,7 @@ fn __action1500<
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__4: (TextSize, ast::Arguments, TextSize),
__5: (TextSize, token::Tok, TextSize),
__6: (TextSize, ast::Suite, TextSize),
@ -65388,7 +65402,7 @@ fn __action1501<
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__4: (TextSize, token::Tok, TextSize),
__5: (TextSize, ast::Suite, TextSize),
) -> ast::Stmt
@ -66070,7 +66084,7 @@ fn __action1528<
mode: Mode,
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, ast::Identifier, TextSize),
__2: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__2: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__3: (TextSize, ast::Arguments, TextSize),
__4: (TextSize, token::Tok, TextSize),
__5: (TextSize, ast::Suite, TextSize),
@ -66104,7 +66118,7 @@ fn __action1529<
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__4: (TextSize, ast::Arguments, TextSize),
__5: (TextSize, token::Tok, TextSize),
__6: (TextSize, ast::Suite, TextSize),
@ -66136,7 +66150,7 @@ fn __action1530<
mode: Mode,
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, ast::Identifier, TextSize),
__2: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__2: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__3: (TextSize, token::Tok, TextSize),
__4: (TextSize, ast::Suite, TextSize),
) -> ast::Stmt
@ -66168,7 +66182,7 @@ fn __action1531<
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__4: (TextSize, token::Tok, TextSize),
__5: (TextSize, ast::Suite, TextSize),
) -> ast::Stmt
@ -66199,7 +66213,7 @@ fn __action1532<
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__4: (TextSize, ast::Parameters, TextSize),
__5: (TextSize, token::Tok, TextSize),
__6: (TextSize, ast::Expr, TextSize),
@ -66239,7 +66253,7 @@ fn __action1533<
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, token::Tok, TextSize),
__3: (TextSize, ast::Identifier, TextSize),
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__4: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__5: (TextSize, ast::Parameters, TextSize),
__6: (TextSize, token::Tok, TextSize),
__7: (TextSize, ast::Expr, TextSize),
@ -66277,7 +66291,7 @@ fn __action1534<
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__4: (TextSize, ast::Parameters, TextSize),
__5: (TextSize, token::Tok, TextSize),
__6: (TextSize, ast::Suite, TextSize),
@ -66313,7 +66327,7 @@ fn __action1535<
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, token::Tok, TextSize),
__3: (TextSize, ast::Identifier, TextSize),
__4: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__4: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__5: (TextSize, ast::Parameters, TextSize),
__6: (TextSize, token::Tok, TextSize),
__7: (TextSize, ast::Suite, TextSize),
@ -66346,7 +66360,7 @@ fn __action1536<
mode: Mode,
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, ast::Identifier, TextSize),
__2: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__2: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__3: (TextSize, ast::Parameters, TextSize),
__4: (TextSize, token::Tok, TextSize),
__5: (TextSize, ast::Expr, TextSize),
@ -66384,7 +66398,7 @@ fn __action1537<
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__4: (TextSize, ast::Parameters, TextSize),
__5: (TextSize, token::Tok, TextSize),
__6: (TextSize, ast::Expr, TextSize),
@ -66420,7 +66434,7 @@ fn __action1538<
mode: Mode,
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, ast::Identifier, TextSize),
__2: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__2: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__3: (TextSize, ast::Parameters, TextSize),
__4: (TextSize, token::Tok, TextSize),
__5: (TextSize, ast::Suite, TextSize),
@ -66454,7 +66468,7 @@ fn __action1539<
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, core::option::Option<Vec<ast::TypeParam>>, TextSize),
__3: (TextSize, core::option::Option<ast::TypeParams>, TextSize),
__4: (TextSize, ast::Parameters, TextSize),
__5: (TextSize, token::Tok, TextSize),
__6: (TextSize, ast::Suite, TextSize),
@ -71718,7 +71732,7 @@ fn __action1712<
mode: Mode,
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, ast::Identifier, TextSize),
__2: (TextSize, Vec<ast::TypeParam>, TextSize),
__2: (TextSize, ast::TypeParams, TextSize),
__3: (TextSize, ast::Arguments, TextSize),
__4: (TextSize, token::Tok, TextSize),
__5: (TextSize, ast::Suite, TextSize),
@ -71781,7 +71795,7 @@ fn __action1714<
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, Vec<ast::TypeParam>, TextSize),
__3: (TextSize, ast::TypeParams, TextSize),
__4: (TextSize, ast::Arguments, TextSize),
__5: (TextSize, token::Tok, TextSize),
__6: (TextSize, ast::Suite, TextSize),
@ -71846,7 +71860,7 @@ fn __action1716<
mode: Mode,
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, ast::Identifier, TextSize),
__2: (TextSize, Vec<ast::TypeParam>, TextSize),
__2: (TextSize, ast::TypeParams, TextSize),
__3: (TextSize, token::Tok, TextSize),
__4: (TextSize, ast::Suite, TextSize),
) -> ast::Stmt
@ -71905,7 +71919,7 @@ fn __action1718<
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, Vec<ast::TypeParam>, TextSize),
__3: (TextSize, ast::TypeParams, TextSize),
__4: (TextSize, token::Tok, TextSize),
__5: (TextSize, ast::Suite, TextSize),
) -> ast::Stmt
@ -71967,7 +71981,7 @@ fn __action1720<
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, Vec<ast::TypeParam>, TextSize),
__3: (TextSize, ast::TypeParams, TextSize),
__4: (TextSize, ast::Parameters, TextSize),
__5: (TextSize, token::Tok, TextSize),
__6: (TextSize, ast::Expr, TextSize),
@ -72042,7 +72056,7 @@ fn __action1722<
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, token::Tok, TextSize),
__3: (TextSize, ast::Identifier, TextSize),
__4: (TextSize, Vec<ast::TypeParam>, TextSize),
__4: (TextSize, ast::TypeParams, TextSize),
__5: (TextSize, ast::Parameters, TextSize),
__6: (TextSize, token::Tok, TextSize),
__7: (TextSize, ast::Expr, TextSize),
@ -72119,7 +72133,7 @@ fn __action1724<
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, Vec<ast::TypeParam>, TextSize),
__3: (TextSize, ast::TypeParams, TextSize),
__4: (TextSize, ast::Parameters, TextSize),
__5: (TextSize, token::Tok, TextSize),
__6: (TextSize, ast::Suite, TextSize),
@ -72186,7 +72200,7 @@ fn __action1726<
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, token::Tok, TextSize),
__3: (TextSize, ast::Identifier, TextSize),
__4: (TextSize, Vec<ast::TypeParam>, TextSize),
__4: (TextSize, ast::TypeParams, TextSize),
__5: (TextSize, ast::Parameters, TextSize),
__6: (TextSize, token::Tok, TextSize),
__7: (TextSize, ast::Suite, TextSize),
@ -72254,7 +72268,7 @@ fn __action1728<
mode: Mode,
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, ast::Identifier, TextSize),
__2: (TextSize, Vec<ast::TypeParam>, TextSize),
__2: (TextSize, ast::TypeParams, TextSize),
__3: (TextSize, ast::Parameters, TextSize),
__4: (TextSize, token::Tok, TextSize),
__5: (TextSize, ast::Expr, TextSize),
@ -72325,7 +72339,7 @@ fn __action1730<
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, Vec<ast::TypeParam>, TextSize),
__3: (TextSize, ast::TypeParams, TextSize),
__4: (TextSize, ast::Parameters, TextSize),
__5: (TextSize, token::Tok, TextSize),
__6: (TextSize, ast::Expr, TextSize),
@ -72398,7 +72412,7 @@ fn __action1732<
mode: Mode,
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, ast::Identifier, TextSize),
__2: (TextSize, Vec<ast::TypeParam>, TextSize),
__2: (TextSize, ast::TypeParams, TextSize),
__3: (TextSize, ast::Parameters, TextSize),
__4: (TextSize, token::Tok, TextSize),
__5: (TextSize, ast::Suite, TextSize),
@ -72461,7 +72475,7 @@ fn __action1734<
__0: (TextSize, alloc::vec::Vec<ast::Decorator>, TextSize),
__1: (TextSize, token::Tok, TextSize),
__2: (TextSize, ast::Identifier, TextSize),
__3: (TextSize, Vec<ast::TypeParam>, TextSize),
__3: (TextSize, ast::TypeParams, TextSize),
__4: (TextSize, ast::Parameters, TextSize),
__5: (TextSize, token::Tok, TextSize),
__6: (TextSize, ast::Suite, TextSize),
@ -72526,7 +72540,7 @@ fn __action1736<
mode: Mode,
__0: (TextSize, token::Tok, TextSize),
__1: (TextSize, ast::Expr, TextSize),
__2: (TextSize, Vec<ast::TypeParam>, TextSize),
__2: (TextSize, ast::TypeParams, TextSize),
__3: (TextSize, token::Tok, TextSize),
__4: (TextSize, ast::Expr, TextSize),
) -> ast::Stmt

View file

@ -7,10 +7,12 @@ Ok(
FunctionDef(
StmtFunctionDef {
range: 0..23,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..17,
posonlyargs: [],
@ -56,6 +58,7 @@ Ok(
],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
@ -63,9 +66,6 @@ Ok(
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
],

View file

@ -7,10 +7,12 @@ Ok(
FunctionDef(
StmtFunctionDef {
range: 0..29,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..23,
posonlyargs: [],
@ -76,6 +78,7 @@ Ok(
],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
@ -83,9 +86,6 @@ Ok(
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
],

View file

@ -7,10 +7,12 @@ Ok(
FunctionDef(
StmtFunctionDef {
range: 0..13,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..7,
posonlyargs: [],
@ -19,6 +21,7 @@ Ok(
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
@ -26,9 +29,6 @@ Ok(
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
],

View file

@ -7,10 +7,12 @@ Ok(
FunctionDef(
StmtFunctionDef {
range: 0..13,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..7,
posonlyargs: [],
@ -19,6 +21,7 @@ Ok(
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
@ -26,9 +29,6 @@ Ok(
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
],

View file

@ -7,10 +7,12 @@ Ok(
FunctionDef(
StmtFunctionDef {
range: 0..32,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..26,
posonlyargs: [],
@ -93,6 +95,7 @@ Ok(
],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
@ -100,9 +103,6 @@ Ok(
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
],

View file

@ -7,10 +7,12 @@ Ok(
FunctionDef(
StmtFunctionDef {
range: 0..38,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..32,
posonlyargs: [],
@ -113,6 +115,7 @@ Ok(
],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
@ -120,9 +123,6 @@ Ok(
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
],

View file

@ -7,10 +7,12 @@ Ok(
FunctionDef(
StmtFunctionDef {
range: 0..42,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..36,
posonlyargs: [],
@ -122,6 +124,7 @@ Ok(
],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
@ -129,9 +132,6 @@ Ok(
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
],

View file

@ -7,10 +7,12 @@ Ok(
FunctionDef(
StmtFunctionDef {
range: 0..52,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..46,
posonlyargs: [],
@ -131,6 +133,7 @@ Ok(
},
),
},
returns: None,
body: [
Pass(
StmtPass {
@ -138,9 +141,6 @@ Ok(
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
],

View file

@ -7,10 +7,12 @@ Ok(
FunctionDef(
StmtFunctionDef {
range: 0..20,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..14,
posonlyargs: [],
@ -56,6 +58,7 @@ Ok(
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
@ -63,9 +66,6 @@ Ok(
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
],

View file

@ -7,10 +7,12 @@ Ok(
FunctionDef(
StmtFunctionDef {
range: 0..26,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..20,
posonlyargs: [],
@ -76,6 +78,7 @@ Ok(
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
@ -83,9 +86,6 @@ Ok(
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
],

View file

@ -7,10 +7,12 @@ Ok(
FunctionDef(
StmtFunctionDef {
range: 0..20,
decorator_list: [],
name: Identifier {
id: "f",
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..14,
posonlyargs: [],
@ -56,6 +58,7 @@ Ok(
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
@ -63,9 +66,6 @@ Ok(
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
],

View file

@ -6,25 +6,6 @@ expression: parse_ast
FunctionDef(
StmtFunctionDef {
range: 0..34,
name: Identifier {
id: "test",
range: 18..22,
},
parameters: Parameters {
range: 22..24,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
body: [
Pass(
StmtPass {
range: 30..34,
},
),
],
decorator_list: [
Decorator {
range: 0..13,
@ -37,26 +18,32 @@ expression: parse_ast
),
},
],
name: Identifier {
id: "test",
range: 18..22,
},
type_params: None,
parameters: Parameters {
range: 22..24,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
type_params: [],
body: [
Pass(
StmtPass {
range: 30..34,
},
),
],
},
),
ClassDef(
StmtClassDef {
range: 36..73,
name: Identifier {
id: "Abcd",
range: 59..63,
},
arguments: None,
body: [
Pass(
StmtPass {
range: 69..73,
},
),
],
type_params: [],
decorator_list: [
Decorator {
range: 36..52,
@ -69,6 +56,19 @@ expression: parse_ast
),
},
],
name: Identifier {
id: "Abcd",
range: 59..63,
},
type_params: None,
arguments: None,
body: [
Pass(
StmtPass {
range: 69..73,
},
),
],
},
),
]

View file

@ -125,10 +125,12 @@ Module(
FunctionDef(
StmtFunctionDef {
range: 566..626,
decorator_list: [],
name: Identifier {
id: "foo",
range: 570..573,
},
type_params: None,
parameters: Parameters {
range: 573..575,
posonlyargs: [],
@ -137,6 +139,7 @@ Module(
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Return(
StmtReturn {
@ -170,9 +173,6 @@ Module(
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
LineMagic(

View file

@ -6,10 +6,12 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
ClassDef(
StmtClassDef {
range: 0..98,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 6..9,
},
type_params: None,
arguments: Some(
Arguments {
range: 9..15,
@ -36,10 +38,12 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
FunctionDef(
StmtFunctionDef {
range: 18..44,
decorator_list: [],
name: Identifier {
id: "__init__",
range: 22..30,
},
type_params: None,
parameters: Parameters {
range: 30..36,
posonlyargs: [],
@ -61,6 +65,7 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
@ -68,18 +73,17 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
FunctionDef(
StmtFunctionDef {
range: 46..98,
decorator_list: [],
name: Identifier {
id: "method_with_default",
range: 50..69,
},
type_params: None,
parameters: Parameters {
range: 69..90,
posonlyargs: [],
@ -123,6 +127,7 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
@ -130,14 +135,9 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
],
type_params: [],
decorator_list: [],
},
),
]

View file

@ -6,10 +6,28 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
ClassDef(
StmtClassDef {
range: 10..29,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 16..19,
},
type_params: Some(
TypeParams {
range: 19..22,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 20..21,
name: Identifier {
id: "T",
range: 20..21,
},
bound: None,
},
),
],
},
),
arguments: Some(
Arguments {
range: 22..24,
@ -31,28 +49,41 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
type_params: [
TypeVar(
TypeParamTypeVar {
range: 20..21,
name: Identifier {
id: "T",
range: 20..21,
},
bound: None,
},
),
],
decorator_list: [],
},
),
ClassDef(
StmtClassDef {
range: 52..76,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 58..61,
},
type_params: Some(
TypeParams {
range: 61..69,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 62..68,
name: Identifier {
id: "T",
range: 62..63,
},
bound: Some(
Name(
ExprName {
range: 65..68,
id: "str",
ctx: Load,
},
),
),
},
),
],
},
),
arguments: Some(
Arguments {
range: 69..71,
@ -74,36 +105,56 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
type_params: [
TypeVar(
TypeParamTypeVar {
range: 62..68,
name: Identifier {
id: "T",
range: 62..63,
},
bound: Some(
Name(
ExprName {
range: 65..68,
id: "str",
ctx: Load,
},
),
),
},
),
],
decorator_list: [],
},
),
ClassDef(
StmtClassDef {
range: 105..138,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 111..114,
},
type_params: Some(
TypeParams {
range: 114..131,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 115..130,
name: Identifier {
id: "T",
range: 115..116,
},
bound: Some(
Tuple(
ExprTuple {
range: 118..130,
elts: [
Name(
ExprName {
range: 119..122,
id: "str",
ctx: Load,
},
),
Name(
ExprName {
range: 124..129,
id: "bytes",
ctx: Load,
},
),
],
ctx: Load,
},
),
),
},
),
],
},
),
arguments: Some(
Arguments {
range: 131..133,
@ -125,51 +176,43 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
type_params: [
TypeVar(
TypeParamTypeVar {
range: 115..130,
name: Identifier {
id: "T",
range: 115..116,
},
bound: Some(
Tuple(
ExprTuple {
range: 118..130,
elts: [
Name(
ExprName {
range: 119..122,
id: "str",
ctx: Load,
},
),
Name(
ExprName {
range: 124..129,
id: "bytes",
ctx: Load,
},
),
],
ctx: Load,
},
),
),
},
),
],
decorator_list: [],
},
),
ClassDef(
StmtClassDef {
range: 159..181,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 165..168,
},
type_params: Some(
TypeParams {
range: 168..174,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 169..170,
name: Identifier {
id: "T",
range: 169..170,
},
bound: None,
},
),
TypeVar(
TypeParamTypeVar {
range: 172..173,
name: Identifier {
id: "U",
range: 172..173,
},
bound: None,
},
),
],
},
),
arguments: Some(
Arguments {
range: 174..176,
@ -191,38 +234,43 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
type_params: [
TypeVar(
TypeParamTypeVar {
range: 169..170,
name: Identifier {
id: "T",
range: 169..170,
},
bound: None,
},
),
TypeVar(
TypeParamTypeVar {
range: 172..173,
name: Identifier {
id: "U",
range: 172..173,
},
bound: None,
},
),
],
decorator_list: [],
},
),
ClassDef(
StmtClassDef {
range: 200..223,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 206..209,
},
type_params: Some(
TypeParams {
range: 209..216,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 210..211,
name: Identifier {
id: "T",
range: 210..211,
},
bound: None,
},
),
TypeVar(
TypeParamTypeVar {
range: 213..214,
name: Identifier {
id: "U",
range: 213..214,
},
bound: None,
},
),
],
},
),
arguments: Some(
Arguments {
range: 216..218,
@ -244,38 +292,32 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
type_params: [
TypeVar(
TypeParamTypeVar {
range: 210..211,
name: Identifier {
id: "T",
range: 210..211,
},
bound: None,
},
),
TypeVar(
TypeParamTypeVar {
range: 213..214,
name: Identifier {
id: "U",
range: 213..214,
},
bound: None,
},
),
],
decorator_list: [],
},
),
ClassDef(
StmtClassDef {
range: 240..261,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 246..249,
},
type_params: Some(
TypeParams {
range: 249..254,
type_params: [
TypeVarTuple(
TypeParamTypeVarTuple {
range: 250..253,
name: Identifier {
id: "Ts",
range: 251..253,
},
},
),
],
},
),
arguments: Some(
Arguments {
range: 254..256,
@ -297,27 +339,32 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
type_params: [
TypeVarTuple(
TypeParamTypeVarTuple {
range: 250..253,
name: Identifier {
id: "Ts",
range: 251..253,
},
},
),
],
decorator_list: [],
},
),
ClassDef(
StmtClassDef {
range: 275..296,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 281..284,
},
type_params: Some(
TypeParams {
range: 284..289,
type_params: [
ParamSpec(
TypeParamParamSpec {
range: 285..288,
name: Identifier {
id: "P",
range: 287..288,
},
},
),
],
},
),
arguments: Some(
Arguments {
range: 289..291,
@ -339,27 +386,69 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
type_params: [
ParamSpec(
TypeParamParamSpec {
range: 285..288,
name: Identifier {
id: "P",
range: 287..288,
},
},
),
],
decorator_list: [],
},
),
ClassDef(
StmtClassDef {
range: 312..351,
decorator_list: [],
name: Identifier {
id: "Foo",
range: 318..321,
},
type_params: Some(
TypeParams {
range: 321..341,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 322..323,
name: Identifier {
id: "X",
range: 322..323,
},
bound: None,
},
),
TypeVar(
TypeParamTypeVar {
range: 325..331,
name: Identifier {
id: "Y",
range: 325..326,
},
bound: Some(
Name(
ExprName {
range: 328..331,
id: "str",
ctx: Load,
},
),
),
},
),
TypeVarTuple(
TypeParamTypeVarTuple {
range: 333..335,
name: Identifier {
id: "U",
range: 334..335,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 337..340,
name: Identifier {
id: "P",
range: 339..340,
},
},
),
],
},
),
arguments: Some(
Arguments {
range: 341..343,
@ -374,55 +463,6 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
type_params: [
TypeVar(
TypeParamTypeVar {
range: 322..323,
name: Identifier {
id: "X",
range: 322..323,
},
bound: None,
},
),
TypeVar(
TypeParamTypeVar {
range: 325..331,
name: Identifier {
id: "Y",
range: 325..326,
},
bound: Some(
Name(
ExprName {
range: 328..331,
id: "str",
ctx: Load,
},
),
),
},
),
TypeVarTuple(
TypeParamTypeVarTuple {
range: 333..335,
name: Identifier {
id: "U",
range: 334..335,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 337..340,
name: Identifier {
id: "P",
range: 339..340,
},
},
),
],
decorator_list: [],
},
),
]

View file

@ -6,10 +6,12 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
FunctionDef(
StmtFunctionDef {
range: 0..20,
decorator_list: [],
name: Identifier {
id: "func",
range: 4..8,
},
type_params: None,
parameters: Parameters {
range: 8..11,
posonlyargs: [],
@ -31,6 +33,7 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Expr(
StmtExpr {
@ -45,18 +48,33 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
decorator_list: [],
returns: None,
type_params: [],
},
),
FunctionDef(
StmtFunctionDef {
range: 22..53,
decorator_list: [],
name: Identifier {
id: "func",
range: 26..30,
},
type_params: Some(
TypeParams {
range: 30..33,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 31..32,
name: Identifier {
id: "T",
range: 31..32,
},
bound: None,
},
),
],
},
),
parameters: Parameters {
range: 33..39,
posonlyargs: [],
@ -86,6 +104,15 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
kwonlyargs: [],
kwarg: None,
},
returns: Some(
Name(
ExprName {
range: 43..44,
id: "T",
ctx: Load,
},
),
),
body: [
Expr(
StmtExpr {
@ -100,37 +127,41 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
decorator_list: [],
returns: Some(
Name(
ExprName {
range: 43..44,
id: "T",
ctx: Load,
},
),
),
type_params: [
TypeVar(
TypeParamTypeVar {
range: 31..32,
name: Identifier {
id: "T",
range: 31..32,
},
bound: None,
},
),
],
},
),
FunctionDef(
StmtFunctionDef {
range: 55..91,
decorator_list: [],
name: Identifier {
id: "func",
range: 59..63,
},
type_params: Some(
TypeParams {
range: 63..71,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 64..70,
name: Identifier {
id: "T",
range: 64..65,
},
bound: Some(
Name(
ExprName {
range: 67..70,
id: "str",
ctx: Load,
},
),
),
},
),
],
},
),
parameters: Parameters {
range: 71..77,
posonlyargs: [],
@ -160,6 +191,15 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
kwonlyargs: [],
kwarg: None,
},
returns: Some(
Name(
ExprName {
range: 81..82,
id: "T",
ctx: Load,
},
),
),
body: [
Expr(
StmtExpr {
@ -174,45 +214,56 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
decorator_list: [],
returns: Some(
Name(
ExprName {
range: 81..82,
id: "T",
ctx: Load,
},
),
),
type_params: [
TypeVar(
TypeParamTypeVar {
range: 64..70,
name: Identifier {
id: "T",
range: 64..65,
},
bound: Some(
Name(
ExprName {
range: 67..70,
id: "str",
ctx: Load,
},
),
),
},
),
],
},
),
FunctionDef(
StmtFunctionDef {
range: 93..138,
decorator_list: [],
name: Identifier {
id: "func",
range: 97..101,
},
type_params: Some(
TypeParams {
range: 101..118,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 102..117,
name: Identifier {
id: "T",
range: 102..103,
},
bound: Some(
Tuple(
ExprTuple {
range: 105..117,
elts: [
Name(
ExprName {
range: 106..109,
id: "str",
ctx: Load,
},
),
Name(
ExprName {
range: 111..116,
id: "bytes",
ctx: Load,
},
),
],
ctx: Load,
},
),
),
},
),
],
},
),
parameters: Parameters {
range: 118..124,
posonlyargs: [],
@ -242,6 +293,15 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
kwonlyargs: [],
kwarg: None,
},
returns: Some(
Name(
ExprName {
range: 128..129,
id: "T",
ctx: Load,
},
),
),
body: [
Expr(
StmtExpr {
@ -256,60 +316,32 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
decorator_list: [],
returns: Some(
Name(
ExprName {
range: 128..129,
id: "T",
ctx: Load,
},
),
),
type_params: [
TypeVar(
TypeParamTypeVar {
range: 102..117,
name: Identifier {
id: "T",
range: 102..103,
},
bound: Some(
Tuple(
ExprTuple {
range: 105..117,
elts: [
Name(
ExprName {
range: 106..109,
id: "str",
ctx: Load,
},
),
Name(
ExprName {
range: 111..116,
id: "bytes",
ctx: Load,
},
),
],
ctx: Load,
},
),
),
},
),
],
},
),
FunctionDef(
StmtFunctionDef {
range: 140..171,
decorator_list: [],
name: Identifier {
id: "func",
range: 144..148,
},
type_params: Some(
TypeParams {
range: 148..153,
type_params: [
TypeVarTuple(
TypeParamTypeVarTuple {
range: 149..152,
name: Identifier {
id: "Ts",
range: 150..152,
},
},
),
],
},
),
parameters: Parameters {
range: 153..162,
posonlyargs: [],
@ -341,6 +373,7 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Expr(
StmtExpr {
@ -355,28 +388,32 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
decorator_list: [],
returns: None,
type_params: [
TypeVarTuple(
TypeParamTypeVarTuple {
range: 149..152,
name: Identifier {
id: "Ts",
range: 150..152,
},
},
),
],
},
),
FunctionDef(
StmtFunctionDef {
range: 173..230,
decorator_list: [],
name: Identifier {
id: "func",
range: 177..181,
},
type_params: Some(
TypeParams {
range: 181..186,
type_params: [
ParamSpec(
TypeParamParamSpec {
range: 182..185,
name: Identifier {
id: "P",
range: 184..185,
},
},
),
],
},
),
parameters: Parameters {
range: 186..221,
posonlyargs: [],
@ -439,6 +476,7 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
},
returns: None,
body: [
Expr(
StmtExpr {
@ -453,28 +491,69 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
decorator_list: [],
returns: None,
type_params: [
ParamSpec(
TypeParamParamSpec {
range: 182..185,
name: Identifier {
id: "P",
range: 184..185,
},
},
),
],
},
),
FunctionDef(
StmtFunctionDef {
range: 232..273,
decorator_list: [],
name: Identifier {
id: "func",
range: 236..240,
},
type_params: Some(
TypeParams {
range: 240..261,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 241..242,
name: Identifier {
id: "T",
range: 241..242,
},
bound: None,
},
),
TypeVar(
TypeParamTypeVar {
range: 244..250,
name: Identifier {
id: "U",
range: 244..245,
},
bound: Some(
Name(
ExprName {
range: 247..250,
id: "str",
ctx: Load,
},
),
),
},
),
TypeVarTuple(
TypeParamTypeVarTuple {
range: 252..255,
name: Identifier {
id: "Ts",
range: 253..255,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 257..260,
name: Identifier {
id: "P",
range: 259..260,
},
},
),
],
},
),
parameters: Parameters {
range: 261..263,
posonlyargs: [],
@ -483,6 +562,7 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Pass(
StmtPass {
@ -490,56 +570,6 @@ expression: "parse_suite(source, \"<test>\").unwrap()"
},
),
],
decorator_list: [],
returns: None,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 241..242,
name: Identifier {
id: "T",
range: 241..242,
},
bound: None,
},
),
TypeVar(
TypeParamTypeVar {
range: 244..250,
name: Identifier {
id: "U",
range: 244..245,
},
bound: Some(
Name(
ExprName {
range: 247..250,
id: "str",
ctx: Load,
},
),
),
},
),
TypeVarTuple(
TypeParamTypeVarTuple {
range: 252..255,
name: Identifier {
id: "Ts",
range: 253..255,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 257..260,
name: Identifier {
id: "P",
range: 259..260,
},
},
),
],
},
),
]

View file

@ -1,6 +1,6 @@
---
source: crates/ruff_python_parser/src/parser.rs
expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
expression: "parse_suite(source, \"<test>\").unwrap()"
---
[
TypeAlias(
@ -13,7 +13,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [],
type_params: None,
value: Name(
ExprName {
range: 10..13,
@ -33,7 +33,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [],
type_params: None,
value: BinOp(
ExprBinOp {
range: 23..32,
@ -66,7 +66,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [],
type_params: None,
value: BinOp(
ExprBinOp {
range: 42..61,
@ -101,18 +101,23 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [
TypeVar(
TypeParamTypeVar {
range: 69..70,
name: Identifier {
id: "T",
range: 69..70,
},
bound: None,
},
),
],
type_params: Some(
TypeParams {
range: 68..71,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 69..70,
name: Identifier {
id: "T",
range: 69..70,
},
bound: None,
},
),
],
},
),
value: BinOp(
ExprBinOp {
range: 74..88,
@ -171,18 +176,23 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [
TypeVar(
TypeParamTypeVar {
range: 109..110,
name: Identifier {
id: "T",
range: 109..110,
},
bound: None,
},
),
],
type_params: Some(
TypeParams {
range: 108..111,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 109..110,
name: Identifier {
id: "T",
range: 109..110,
},
bound: None,
},
),
],
},
),
value: Name(
ExprName {
range: 114..117,
@ -202,18 +212,23 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [
TypeVar(
TypeParamTypeVar {
range: 125..126,
name: Identifier {
id: "T",
range: 125..126,
},
bound: None,
},
),
],
type_params: Some(
TypeParams {
range: 124..127,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 125..126,
name: Identifier {
id: "T",
range: 125..126,
},
bound: None,
},
),
],
},
),
value: BinOp(
ExprBinOp {
range: 130..146,
@ -272,36 +287,41 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [
TypeVar(
TypeParamTypeVar {
range: 154..155,
name: Identifier {
id: "T",
range: 154..155,
},
bound: None,
},
),
TypeVarTuple(
TypeParamTypeVarTuple {
range: 157..160,
name: Identifier {
id: "Ts",
range: 158..160,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 162..165,
name: Identifier {
id: "P",
range: 164..165,
},
},
),
],
type_params: Some(
TypeParams {
range: 153..166,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 154..155,
name: Identifier {
id: "T",
range: 154..155,
},
bound: None,
},
),
TypeVarTuple(
TypeParamTypeVarTuple {
range: 157..160,
name: Identifier {
id: "Ts",
range: 158..160,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 162..165,
name: Identifier {
id: "P",
range: 164..165,
},
},
),
],
},
),
value: Tuple(
ExprTuple {
range: 169..179,
@ -343,44 +363,49 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [
TypeVar(
TypeParamTypeVar {
range: 187..193,
name: Identifier {
id: "T",
range: 187..188,
},
bound: Some(
Name(
ExprName {
range: 190..193,
id: "int",
ctx: Load,
type_params: Some(
TypeParams {
range: 186..204,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 187..193,
name: Identifier {
id: "T",
range: 187..188,
},
),
bound: Some(
Name(
ExprName {
range: 190..193,
id: "int",
ctx: Load,
},
),
),
},
),
},
),
TypeVarTuple(
TypeParamTypeVarTuple {
range: 195..198,
name: Identifier {
id: "Ts",
range: 196..198,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 200..203,
name: Identifier {
id: "P",
range: 202..203,
},
},
),
],
TypeVarTuple(
TypeParamTypeVarTuple {
range: 195..198,
name: Identifier {
id: "Ts",
range: 196..198,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 200..203,
name: Identifier {
id: "P",
range: 202..203,
},
},
),
],
},
),
value: Tuple(
ExprTuple {
range: 207..217,
@ -422,59 +447,64 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [
TypeVar(
TypeParamTypeVar {
range: 225..238,
name: Identifier {
id: "T",
range: 225..226,
},
bound: Some(
Tuple(
ExprTuple {
range: 228..238,
elts: [
Name(
ExprName {
range: 229..232,
id: "int",
ctx: Load,
},
),
Name(
ExprName {
range: 234..237,
id: "str",
ctx: Load,
},
),
],
ctx: Load,
type_params: Some(
TypeParams {
range: 224..249,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 225..238,
name: Identifier {
id: "T",
range: 225..226,
},
),
bound: Some(
Tuple(
ExprTuple {
range: 228..238,
elts: [
Name(
ExprName {
range: 229..232,
id: "int",
ctx: Load,
},
),
Name(
ExprName {
range: 234..237,
id: "str",
ctx: Load,
},
),
],
ctx: Load,
},
),
),
},
),
},
),
TypeVarTuple(
TypeParamTypeVarTuple {
range: 240..243,
name: Identifier {
id: "Ts",
range: 241..243,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 245..248,
name: Identifier {
id: "P",
range: 247..248,
},
},
),
],
TypeVarTuple(
TypeParamTypeVarTuple {
range: 240..243,
name: Identifier {
id: "Ts",
range: 241..243,
},
},
),
ParamSpec(
TypeParamParamSpec {
range: 245..248,
name: Identifier {
id: "P",
range: 247..248,
},
},
),
],
},
),
value: Tuple(
ExprTuple {
range: 252..262,
@ -516,7 +546,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [],
type_params: None,
value: Name(
ExprName {
range: 305..308,
@ -536,7 +566,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [],
type_params: None,
value: Name(
ExprName {
range: 322..325,
@ -556,7 +586,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [],
type_params: None,
value: Name(
ExprName {
range: 338..341,
@ -576,7 +606,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [],
type_params: None,
value: Name(
ExprName {
range: 378..382,
@ -596,7 +626,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [],
type_params: None,
value: Name(
ExprName {
range: 394..399,
@ -616,7 +646,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [],
type_params: None,
value: Name(
ExprName {
range: 411..415,
@ -636,7 +666,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [],
type_params: None,
value: Name(
ExprName {
range: 451..454,
@ -656,7 +686,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [],
type_params: None,
value: Name(
ExprName {
range: 467..470,
@ -676,7 +706,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [],
type_params: None,
value: Name(
ExprName {
range: 483..486,
@ -696,7 +726,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [],
type_params: None,
value: Name(
ExprName {
range: 502..505,
@ -716,18 +746,23 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [
TypeVar(
TypeParamTypeVar {
range: 521..522,
name: Identifier {
id: "T",
range: 521..522,
},
bound: None,
},
),
],
type_params: Some(
TypeParams {
range: 520..523,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 521..522,
name: Identifier {
id: "T",
range: 521..522,
},
bound: None,
},
),
],
},
),
value: Name(
ExprName {
range: 526..527,
@ -747,18 +782,23 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [
TypeVar(
TypeParamTypeVar {
range: 542..543,
name: Identifier {
id: "T",
range: 542..543,
},
bound: None,
},
),
],
type_params: Some(
TypeParams {
range: 541..544,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 542..543,
name: Identifier {
id: "T",
range: 542..543,
},
bound: None,
},
),
],
},
),
value: Name(
ExprName {
range: 547..548,
@ -778,18 +818,23 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
ctx: Store,
},
),
type_params: [
TypeVar(
TypeParamTypeVar {
range: 556..557,
name: Identifier {
id: "T",
range: 556..557,
},
bound: None,
},
),
],
type_params: Some(
TypeParams {
range: 555..558,
type_params: [
TypeVar(
TypeParamTypeVar {
range: 556..557,
name: Identifier {
id: "T",
range: 556..557,
},
bound: None,
},
),
],
},
),
value: Name(
ExprName {
range: 567..568,

View file

@ -6,10 +6,12 @@ expression: parse_ast
FunctionDef(
StmtFunctionDef {
range: 1..49,
decorator_list: [],
name: Identifier {
id: "args_to_tuple",
range: 5..18,
},
type_params: None,
parameters: Parameters {
range: 18..30,
posonlyargs: [],
@ -41,21 +43,6 @@ expression: parse_ast
kwonlyargs: [],
kwarg: None,
},
body: [
Expr(
StmtExpr {
range: 46..49,
value: Constant(
ExprConstant {
range: 46..49,
value: Ellipsis,
kind: None,
},
),
},
),
],
decorator_list: [],
returns: Some(
Subscript(
ExprSubscript {
@ -84,7 +71,20 @@ expression: parse_ast
},
),
),
type_params: [],
body: [
Expr(
StmtExpr {
range: 46..49,
value: Constant(
ExprConstant {
range: 46..49,
value: Ellipsis,
kind: None,
},
),
},
),
],
},
),
]