diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-07 13:13:36 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-07 13:13:36 +0000 |
commit | 6d6a995e09c74a8b1075842fb3cd7232354389ae (patch) | |
tree | e445538d8619848896b69cfae6a80672b1faceb1 /crates/ra_syntax/test_data/parser/ok/0030_traits.txt | |
parent | 4d0d113c7d17483f3a6e0d09db7cc0cb5ed145c4 (diff) | |
parent | 90ff2be4e820601a1d16ba5716916f7424dfa10d (diff) |
Merge #3040
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 <[email protected]>
Diffstat (limited to 'crates/ra_syntax/test_data/parser/ok/0030_traits.txt')
-rw-r--r-- | crates/ra_syntax/test_data/parser/ok/0030_traits.txt | 154 |
1 files changed, 61 insertions, 93 deletions
diff --git a/crates/ra_syntax/test_data/parser/ok/0030_traits.txt b/crates/ra_syntax/test_data/parser/ok/0030_traits.txt index b656c1a81..ac314ae50 100644 --- a/crates/ra_syntax/test_data/parser/ok/0030_traits.txt +++ b/crates/ra_syntax/test_data/parser/ok/0030_traits.txt | |||
@@ -1,93 +1,61 @@ | |||
1 | SOURCE_FILE@[0; 164) | 1 | SOURCE_FILE@[0; 96) |
2 | TRAIT_DEF@[0; 66) | 2 | TRAIT_DEF@[0; 36) |
3 | VISIBILITY@[0; 3) | 3 | TRAIT_KW@[0; 5) "trait" |
4 | PUB_KW@[0; 3) "pub" | 4 | WHITESPACE@[5; 6) " " |
5 | WHITESPACE@[3; 4) " " | 5 | NAME@[6; 14) |
6 | TRAIT_KW@[4; 9) "trait" | 6 | IDENT@[6; 14) "Runnable" |
7 | WHITESPACE@[9; 10) " " | 7 | WHITESPACE@[14; 15) " " |
8 | NAME@[10; 22) | 8 | ITEM_LIST@[15; 36) |
9 | IDENT@[10; 22) "WriteMessage" | 9 | L_CURLY@[15; 16) "{" |
10 | WHITESPACE@[22; 23) " " | 10 | WHITESPACE@[16; 21) "\n " |
11 | ITEM_LIST@[23; 66) | 11 | FN_DEF@[21; 34) |
12 | L_CURLY@[23; 24) "{" | 12 | FN_KW@[21; 23) "fn" |
13 | WHITESPACE@[24; 29) "\n " | 13 | WHITESPACE@[23; 24) " " |
14 | FN_DEF@[29; 64) | 14 | NAME@[24; 31) |
15 | FN_KW@[29; 31) "fn" | 15 | IDENT@[24; 31) "handler" |
16 | WHITESPACE@[31; 32) " " | 16 | PARAM_LIST@[31; 33) |
17 | NAME@[32; 45) | 17 | L_PAREN@[31; 32) "(" |
18 | IDENT@[32; 45) "write_message" | 18 | R_PAREN@[32; 33) ")" |
19 | PARAM_LIST@[45; 63) | 19 | SEMI@[33; 34) ";" |
20 | L_PAREN@[45; 46) "(" | 20 | WHITESPACE@[34; 35) "\n" |
21 | PARAM@[46; 62) | 21 | R_CURLY@[35; 36) "}" |
22 | REFERENCE_TYPE@[46; 62) | 22 | WHITESPACE@[36; 38) "\n\n" |
23 | AMP@[46; 47) "&" | 23 | TRAIT_DEF@[38; 95) |
24 | PATH_TYPE@[47; 62) | 24 | TRAIT_KW@[38; 43) "trait" |
25 | PATH@[47; 62) | 25 | WHITESPACE@[43; 44) " " |
26 | PATH_SEGMENT@[47; 62) | 26 | NAME@[44; 57) |
27 | NAME_REF@[47; 62) | 27 | IDENT@[44; 57) "TraitWithExpr" |
28 | IDENT@[47; 62) "FrontendMessage" | 28 | WHITESPACE@[57; 58) " " |
29 | R_PAREN@[62; 63) ")" | 29 | ITEM_LIST@[58; 95) |
30 | SEMI@[63; 64) ";" | 30 | L_CURLY@[58; 59) "{" |
31 | WHITESPACE@[64; 65) "\n" | 31 | WHITESPACE@[59; 64) "\n " |
32 | R_CURLY@[65; 66) "}" | 32 | FN_DEF@[64; 93) |
33 | WHITESPACE@[66; 68) "\n\n" | 33 | FN_KW@[64; 66) "fn" |
34 | TRAIT_DEF@[68; 104) | 34 | WHITESPACE@[66; 67) " " |
35 | TRAIT_KW@[68; 73) "trait" | 35 | NAME@[67; 79) |
36 | WHITESPACE@[73; 74) " " | 36 | IDENT@[67; 79) "fn_with_expr" |
37 | NAME@[74; 82) | 37 | PARAM_LIST@[79; 92) |
38 | IDENT@[74; 82) "Runnable" | 38 | L_PAREN@[79; 80) "(" |
39 | WHITESPACE@[82; 83) " " | 39 | PARAM@[80; 91) |
40 | ITEM_LIST@[83; 104) | 40 | BIND_PAT@[80; 81) |
41 | L_CURLY@[83; 84) "{" | 41 | NAME@[80; 81) |
42 | WHITESPACE@[84; 89) "\n " | 42 | IDENT@[80; 81) "x" |
43 | FN_DEF@[89; 102) | 43 | COLON@[81; 82) ":" |
44 | FN_KW@[89; 91) "fn" | 44 | WHITESPACE@[82; 83) " " |
45 | WHITESPACE@[91; 92) " " | 45 | ARRAY_TYPE@[83; 91) |
46 | NAME@[92; 99) | 46 | L_BRACK@[83; 84) "[" |
47 | IDENT@[92; 99) "handler" | 47 | PATH_TYPE@[84; 87) |
48 | PARAM_LIST@[99; 101) | 48 | PATH@[84; 87) |
49 | L_PAREN@[99; 100) "(" | 49 | PATH_SEGMENT@[84; 87) |
50 | R_PAREN@[100; 101) ")" | 50 | NAME_REF@[84; 87) |
51 | SEMI@[101; 102) ";" | 51 | IDENT@[84; 87) "i32" |
52 | WHITESPACE@[102; 103) "\n" | 52 | SEMI@[87; 88) ";" |
53 | R_CURLY@[103; 104) "}" | 53 | WHITESPACE@[88; 89) " " |
54 | WHITESPACE@[104; 106) "\n\n" | 54 | LITERAL@[89; 90) |
55 | TRAIT_DEF@[106; 163) | 55 | INT_NUMBER@[89; 90) "1" |
56 | TRAIT_KW@[106; 111) "trait" | 56 | R_BRACK@[90; 91) "]" |
57 | WHITESPACE@[111; 112) " " | 57 | R_PAREN@[91; 92) ")" |
58 | NAME@[112; 125) | 58 | SEMI@[92; 93) ";" |
59 | IDENT@[112; 125) "TraitWithExpr" | 59 | WHITESPACE@[93; 94) "\n" |
60 | WHITESPACE@[125; 126) " " | 60 | R_CURLY@[94; 95) "}" |
61 | ITEM_LIST@[126; 163) | 61 | WHITESPACE@[95; 96) "\n" |
62 | L_CURLY@[126; 127) "{" | ||
63 | WHITESPACE@[127; 132) "\n " | ||
64 | FN_DEF@[132; 161) | ||
65 | FN_KW@[132; 134) "fn" | ||
66 | WHITESPACE@[134; 135) " " | ||
67 | NAME@[135; 147) | ||
68 | IDENT@[135; 147) "fn_with_expr" | ||
69 | PARAM_LIST@[147; 160) | ||
70 | L_PAREN@[147; 148) "(" | ||
71 | PARAM@[148; 159) | ||
72 | BIND_PAT@[148; 149) | ||
73 | NAME@[148; 149) | ||
74 | IDENT@[148; 149) "x" | ||
75 | COLON@[149; 150) ":" | ||
76 | WHITESPACE@[150; 151) " " | ||
77 | ARRAY_TYPE@[151; 159) | ||
78 | L_BRACK@[151; 152) "[" | ||
79 | PATH_TYPE@[152; 155) | ||
80 | PATH@[152; 155) | ||
81 | PATH_SEGMENT@[152; 155) | ||
82 | NAME_REF@[152; 155) | ||
83 | IDENT@[152; 155) "i32" | ||
84 | SEMI@[155; 156) ";" | ||
85 | WHITESPACE@[156; 157) " " | ||
86 | LITERAL@[157; 158) | ||
87 | INT_NUMBER@[157; 158) "1" | ||
88 | R_BRACK@[158; 159) "]" | ||
89 | R_PAREN@[159; 160) ")" | ||
90 | SEMI@[160; 161) ";" | ||
91 | WHITESPACE@[161; 162) "\n" | ||
92 | R_CURLY@[162; 163) "}" | ||
93 | WHITESPACE@[163; 164) "\n" | ||