-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3040: Rework value parameter parsing r=matklad a=tobz1000 Fixes #2847. - `Fn__(...)` parameters with idents/patterns no longer parse - Trait function parameters with arbitrary patterns parse - Trait function parameters without idents/patterns no longer parse - `fn(...)` parameters no longer parse with patterns other than a single ident __Question__: The pre-existing test `param_list_opt_patterns` has been kept as-is, although the name no longer makes sense (it's testing `Fn__(...)` params, which aren't allowed patterns any more). What would be best to do about this? Co-authored-by: Toby Dimmick <tobydimmick@pm.me>
- Loading branch information
Showing
19 changed files
with
686 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
type F = Box<Fn(a: i32, &b: &i32, &mut c: &i32, ())>; | ||
type F = Box<Fn(i32, &i32, &i32, ())>; |
115 changes: 47 additions & 68 deletions
115
crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,60 @@ | ||
SOURCE_FILE@[0; 54) | ||
TYPE_ALIAS_DEF@[0; 53) | ||
SOURCE_FILE@[0; 39) | ||
TYPE_ALIAS_DEF@[0; 38) | ||
TYPE_KW@[0; 4) "type" | ||
WHITESPACE@[4; 5) " " | ||
NAME@[5; 6) | ||
IDENT@[5; 6) "F" | ||
WHITESPACE@[6; 7) " " | ||
EQ@[7; 8) "=" | ||
WHITESPACE@[8; 9) " " | ||
PATH_TYPE@[9; 52) | ||
PATH@[9; 52) | ||
PATH_SEGMENT@[9; 52) | ||
PATH_TYPE@[9; 37) | ||
PATH@[9; 37) | ||
PATH_SEGMENT@[9; 37) | ||
NAME_REF@[9; 12) | ||
IDENT@[9; 12) "Box" | ||
TYPE_ARG_LIST@[12; 52) | ||
TYPE_ARG_LIST@[12; 37) | ||
L_ANGLE@[12; 13) "<" | ||
TYPE_ARG@[13; 51) | ||
PATH_TYPE@[13; 51) | ||
PATH@[13; 51) | ||
PATH_SEGMENT@[13; 51) | ||
TYPE_ARG@[13; 36) | ||
PATH_TYPE@[13; 36) | ||
PATH@[13; 36) | ||
PATH_SEGMENT@[13; 36) | ||
NAME_REF@[13; 15) | ||
IDENT@[13; 15) "Fn" | ||
PARAM_LIST@[15; 51) | ||
PARAM_LIST@[15; 36) | ||
L_PAREN@[15; 16) "(" | ||
PARAM@[16; 22) | ||
BIND_PAT@[16; 17) | ||
NAME@[16; 17) | ||
IDENT@[16; 17) "a" | ||
COLON@[17; 18) ":" | ||
WHITESPACE@[18; 19) " " | ||
PATH_TYPE@[19; 22) | ||
PATH@[19; 22) | ||
PATH_SEGMENT@[19; 22) | ||
NAME_REF@[19; 22) | ||
IDENT@[19; 22) "i32" | ||
COMMA@[22; 23) "," | ||
WHITESPACE@[23; 24) " " | ||
PARAM@[24; 32) | ||
REF_PAT@[24; 26) | ||
AMP@[24; 25) "&" | ||
BIND_PAT@[25; 26) | ||
NAME@[25; 26) | ||
IDENT@[25; 26) "b" | ||
COLON@[26; 27) ":" | ||
WHITESPACE@[27; 28) " " | ||
REFERENCE_TYPE@[28; 32) | ||
AMP@[28; 29) "&" | ||
PATH_TYPE@[29; 32) | ||
PATH@[29; 32) | ||
PATH_SEGMENT@[29; 32) | ||
NAME_REF@[29; 32) | ||
IDENT@[29; 32) "i32" | ||
COMMA@[32; 33) "," | ||
WHITESPACE@[33; 34) " " | ||
PARAM@[34; 46) | ||
REF_PAT@[34; 40) | ||
AMP@[34; 35) "&" | ||
MUT_KW@[35; 38) "mut" | ||
WHITESPACE@[38; 39) " " | ||
BIND_PAT@[39; 40) | ||
NAME@[39; 40) | ||
IDENT@[39; 40) "c" | ||
COLON@[40; 41) ":" | ||
WHITESPACE@[41; 42) " " | ||
REFERENCE_TYPE@[42; 46) | ||
AMP@[42; 43) "&" | ||
PATH_TYPE@[43; 46) | ||
PATH@[43; 46) | ||
PATH_SEGMENT@[43; 46) | ||
NAME_REF@[43; 46) | ||
IDENT@[43; 46) "i32" | ||
COMMA@[46; 47) "," | ||
WHITESPACE@[47; 48) " " | ||
PARAM@[48; 50) | ||
TUPLE_TYPE@[48; 50) | ||
L_PAREN@[48; 49) "(" | ||
R_PAREN@[49; 50) ")" | ||
R_PAREN@[50; 51) ")" | ||
R_ANGLE@[51; 52) ">" | ||
SEMI@[52; 53) ";" | ||
WHITESPACE@[53; 54) "\n" | ||
PARAM@[16; 19) | ||
PATH_TYPE@[16; 19) | ||
PATH@[16; 19) | ||
PATH_SEGMENT@[16; 19) | ||
NAME_REF@[16; 19) | ||
IDENT@[16; 19) "i32" | ||
COMMA@[19; 20) "," | ||
WHITESPACE@[20; 21) " " | ||
PARAM@[21; 25) | ||
REFERENCE_TYPE@[21; 25) | ||
AMP@[21; 22) "&" | ||
PATH_TYPE@[22; 25) | ||
PATH@[22; 25) | ||
PATH_SEGMENT@[22; 25) | ||
NAME_REF@[22; 25) | ||
IDENT@[22; 25) "i32" | ||
COMMA@[25; 26) "," | ||
WHITESPACE@[26; 27) " " | ||
PARAM@[27; 31) | ||
REFERENCE_TYPE@[27; 31) | ||
AMP@[27; 28) "&" | ||
PATH_TYPE@[28; 31) | ||
PATH@[28; 31) | ||
PATH_SEGMENT@[28; 31) | ||
NAME_REF@[28; 31) | ||
IDENT@[28; 31) "i32" | ||
COMMA@[31; 32) "," | ||
WHITESPACE@[32; 33) " " | ||
PARAM@[33; 35) | ||
TUPLE_TYPE@[33; 35) | ||
L_PAREN@[33; 34) "(" | ||
R_PAREN@[34; 35) ")" | ||
R_PAREN@[35; 36) ")" | ||
R_ANGLE@[36; 37) ">" | ||
SEMI@[37; 38) ";" | ||
WHITESPACE@[38; 39) "\n" |
2 changes: 1 addition & 1 deletion
2
crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
type F = Box<Fn(x: i32) -> ()>; | ||
type F = Box<Fn(i32) -> ()>; |
Oops, something went wrong.