mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 17:28:09 +00:00
function type params
This commit is contained in:
parent
3d70aeb412
commit
eba1e8a334
5 changed files with 71 additions and 0 deletions
|
@ -234,6 +234,10 @@ fn fn_item(p: &mut Parser) {
|
|||
p.bump();
|
||||
|
||||
name(p);
|
||||
// test fn_item_type_params
|
||||
// fn foo<T: Clone + Copy>(){}
|
||||
type_params::list(p);
|
||||
|
||||
if p.at(L_PAREN) {
|
||||
fn_value_parameters(p);
|
||||
} else {
|
||||
|
@ -243,6 +247,11 @@ fn fn_item(p: &mut Parser) {
|
|||
// fn foo() {}
|
||||
// fn bar() -> () {}
|
||||
fn_ret_type(p);
|
||||
|
||||
// test fn_item_where_clause
|
||||
// fn foo<T>() where T: Copy {}
|
||||
type_params::where_clause(p);
|
||||
|
||||
block(p);
|
||||
|
||||
// test block
|
||||
|
|
1
tests/data/parser/inline/0059_fn_item_where_clause.rs
Normal file
1
tests/data/parser/inline/0059_fn_item_where_clause.rs
Normal file
|
@ -0,0 +1 @@
|
|||
fn foo<T>() where T: Copy {}
|
28
tests/data/parser/inline/0059_fn_item_where_clause.txt
Normal file
28
tests/data/parser/inline/0059_fn_item_where_clause.txt
Normal file
|
@ -0,0 +1,28 @@
|
|||
FILE@[0; 29)
|
||||
FN_ITEM@[0; 29)
|
||||
FN_KW@[0; 2)
|
||||
NAME@[2; 6)
|
||||
WHITESPACE@[2; 3)
|
||||
IDENT@[3; 6) "foo"
|
||||
TYPE_PARAM_LIST@[6; 9)
|
||||
L_ANGLE@[6; 7)
|
||||
TYPE_PARAM@[7; 8)
|
||||
NAME@[7; 8)
|
||||
IDENT@[7; 8) "T"
|
||||
R_ANGLE@[8; 9)
|
||||
PARAM_LIST@[9; 12)
|
||||
L_PAREN@[9; 10)
|
||||
R_PAREN@[10; 11)
|
||||
WHITESPACE@[11; 12)
|
||||
WHERE_CLAUSE@[12; 26)
|
||||
WHERE_KW@[12; 17)
|
||||
WHITESPACE@[17; 18)
|
||||
IDENT@[18; 19) "T"
|
||||
COLON@[19; 20)
|
||||
WHITESPACE@[20; 21)
|
||||
IDENT@[21; 25) "Copy"
|
||||
WHITESPACE@[25; 26)
|
||||
BLOCK@[26; 29)
|
||||
L_CURLY@[26; 27)
|
||||
R_CURLY@[27; 28)
|
||||
WHITESPACE@[28; 29)
|
1
tests/data/parser/inline/0060_fn_item_type_params.rs
Normal file
1
tests/data/parser/inline/0060_fn_item_type_params.rs
Normal file
|
@ -0,0 +1 @@
|
|||
fn foo<T: Clone + Copy>(){}
|
32
tests/data/parser/inline/0060_fn_item_type_params.txt
Normal file
32
tests/data/parser/inline/0060_fn_item_type_params.txt
Normal file
|
@ -0,0 +1,32 @@
|
|||
FILE@[0; 28)
|
||||
FN_ITEM@[0; 28)
|
||||
FN_KW@[0; 2)
|
||||
NAME@[2; 6)
|
||||
WHITESPACE@[2; 3)
|
||||
IDENT@[3; 6) "foo"
|
||||
TYPE_PARAM_LIST@[6; 23)
|
||||
L_ANGLE@[6; 7)
|
||||
TYPE_PARAM@[7; 22)
|
||||
NAME@[7; 8)
|
||||
IDENT@[7; 8) "T"
|
||||
COLON@[8; 9)
|
||||
PATH@[9; 16)
|
||||
PATH_SEGMENT@[9; 16)
|
||||
NAME_REF@[9; 16)
|
||||
WHITESPACE@[9; 10)
|
||||
IDENT@[10; 15) "Clone"
|
||||
WHITESPACE@[15; 16)
|
||||
PLUS@[16; 17)
|
||||
PATH@[17; 22)
|
||||
PATH_SEGMENT@[17; 22)
|
||||
NAME_REF@[17; 22)
|
||||
WHITESPACE@[17; 18)
|
||||
IDENT@[18; 22) "Copy"
|
||||
R_ANGLE@[22; 23)
|
||||
PARAM_LIST@[23; 25)
|
||||
L_PAREN@[23; 24)
|
||||
R_PAREN@[24; 25)
|
||||
BLOCK@[25; 28)
|
||||
L_CURLY@[25; 26)
|
||||
R_CURLY@[26; 27)
|
||||
WHITESPACE@[27; 28)
|
Loading…
Reference in a new issue