diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-03-14 09:17:21 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-03-14 09:17:21 +0000 |
commit | a0ded3f7c0353cdd61e9dc0ddd8e64ba8c1e64ef (patch) | |
tree | d251d88ce50996846924d9f4d82b6ba3fcd4b83b /crates/ra_syntax/tests/data/parser/ok | |
parent | f7065c294c24b48014f2b2594126dad4a43caee8 (diff) | |
parent | 943d2fb781b01a1a852c03319ffdeb3ab3800d99 (diff) |
Merge #974
974: Add MINUS token the PATTERN_FIRST token set r=matklad a=mchesser
Fixes: #972
Co-authored-by: Michael Chesser <[email protected]>
Diffstat (limited to 'crates/ra_syntax/tests/data/parser/ok')
-rw-r--r-- | crates/ra_syntax/tests/data/parser/ok/0047_minus_in_inner_pattern.rs | 27 | ||||
-rw-r--r-- | crates/ra_syntax/tests/data/parser/ok/0047_minus_in_inner_pattern.txt | 320 |
2 files changed, 347 insertions, 0 deletions
diff --git a/crates/ra_syntax/tests/data/parser/ok/0047_minus_in_inner_pattern.rs b/crates/ra_syntax/tests/data/parser/ok/0047_minus_in_inner_pattern.rs new file mode 100644 index 000000000..bbd6b0f6e --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/ok/0047_minus_in_inner_pattern.rs | |||
@@ -0,0 +1,27 @@ | |||
1 | // https://github.com/rust-analyzer/rust-analyzer/issues/972 | ||
2 | |||
3 | fn main() { | ||
4 | match Some(-1) { | ||
5 | Some(-1) => (), | ||
6 | _ => (), | ||
7 | } | ||
8 | |||
9 | match Some((-1, -1)) { | ||
10 | Some((-1, -1)) => (), | ||
11 | _ => (), | ||
12 | } | ||
13 | |||
14 | match A::B(-1, -1) { | ||
15 | A::B(-1, -1) => (), | ||
16 | _ => (), | ||
17 | } | ||
18 | |||
19 | if let Some(-1) = Some(-1) { | ||
20 | } | ||
21 | } | ||
22 | |||
23 | enum A { | ||
24 | B(i8, i8) | ||
25 | } | ||
26 | |||
27 | fn foo(-128..=127: i8) {} | ||
diff --git a/crates/ra_syntax/tests/data/parser/ok/0047_minus_in_inner_pattern.txt b/crates/ra_syntax/tests/data/parser/ok/0047_minus_in_inner_pattern.txt new file mode 100644 index 000000000..ca66b44bb --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/ok/0047_minus_in_inner_pattern.txt | |||
@@ -0,0 +1,320 @@ | |||
1 | SOURCE_FILE@[0; 395) | ||
2 | COMMENT@[0; 60) | ||
3 | WHITESPACE@[60; 62) | ||
4 | FN_DEF@[62; 341) | ||
5 | FN_KW@[62; 64) | ||
6 | WHITESPACE@[64; 65) | ||
7 | NAME@[65; 69) | ||
8 | IDENT@[65; 69) "main" | ||
9 | PARAM_LIST@[69; 71) | ||
10 | L_PAREN@[69; 70) | ||
11 | R_PAREN@[70; 71) | ||
12 | WHITESPACE@[71; 72) | ||
13 | BLOCK@[72; 341) | ||
14 | L_CURLY@[72; 73) | ||
15 | WHITESPACE@[73; 78) | ||
16 | EXPR_STMT@[78; 141) | ||
17 | MATCH_EXPR@[78; 141) | ||
18 | MATCH_KW@[78; 83) | ||
19 | WHITESPACE@[83; 84) | ||
20 | CALL_EXPR@[84; 92) | ||
21 | PATH_EXPR@[84; 88) | ||
22 | PATH@[84; 88) | ||
23 | PATH_SEGMENT@[84; 88) | ||
24 | NAME_REF@[84; 88) | ||
25 | IDENT@[84; 88) "Some" | ||
26 | ARG_LIST@[88; 92) | ||
27 | L_PAREN@[88; 89) | ||
28 | PREFIX_EXPR@[89; 91) | ||
29 | MINUS@[89; 90) | ||
30 | LITERAL@[90; 91) | ||
31 | INT_NUMBER@[90; 91) "1" | ||
32 | R_PAREN@[91; 92) | ||
33 | WHITESPACE@[92; 93) | ||
34 | MATCH_ARM_LIST@[93; 141) | ||
35 | L_CURLY@[93; 94) | ||
36 | WHITESPACE@[94; 103) | ||
37 | MATCH_ARM@[103; 117) | ||
38 | TUPLE_STRUCT_PAT@[103; 111) | ||
39 | PATH@[103; 107) | ||
40 | PATH_SEGMENT@[103; 107) | ||
41 | NAME_REF@[103; 107) | ||
42 | IDENT@[103; 107) "Some" | ||
43 | L_PAREN@[107; 108) | ||
44 | LITERAL_PAT@[108; 110) | ||
45 | MINUS@[108; 109) | ||
46 | LITERAL@[109; 110) | ||
47 | INT_NUMBER@[109; 110) "1" | ||
48 | R_PAREN@[110; 111) | ||
49 | WHITESPACE@[111; 112) | ||
50 | FAT_ARROW@[112; 114) | ||
51 | WHITESPACE@[114; 115) | ||
52 | TUPLE_EXPR@[115; 117) | ||
53 | L_PAREN@[115; 116) | ||
54 | R_PAREN@[116; 117) | ||
55 | COMMA@[117; 118) | ||
56 | WHITESPACE@[118; 127) | ||
57 | MATCH_ARM@[127; 134) | ||
58 | PLACEHOLDER_PAT@[127; 128) | ||
59 | UNDERSCORE@[127; 128) | ||
60 | WHITESPACE@[128; 129) | ||
61 | FAT_ARROW@[129; 131) | ||
62 | WHITESPACE@[131; 132) | ||
63 | TUPLE_EXPR@[132; 134) | ||
64 | L_PAREN@[132; 133) | ||
65 | R_PAREN@[133; 134) | ||
66 | COMMA@[134; 135) | ||
67 | WHITESPACE@[135; 140) | ||
68 | R_CURLY@[140; 141) | ||
69 | WHITESPACE@[141; 147) | ||
70 | EXPR_STMT@[147; 222) | ||
71 | MATCH_EXPR@[147; 222) | ||
72 | MATCH_KW@[147; 152) | ||
73 | WHITESPACE@[152; 153) | ||
74 | CALL_EXPR@[153; 167) | ||
75 | PATH_EXPR@[153; 157) | ||
76 | PATH@[153; 157) | ||
77 | PATH_SEGMENT@[153; 157) | ||
78 | NAME_REF@[153; 157) | ||
79 | IDENT@[153; 157) "Some" | ||
80 | ARG_LIST@[157; 167) | ||
81 | L_PAREN@[157; 158) | ||
82 | TUPLE_EXPR@[158; 166) | ||
83 | L_PAREN@[158; 159) | ||
84 | PREFIX_EXPR@[159; 161) | ||
85 | MINUS@[159; 160) | ||
86 | LITERAL@[160; 161) | ||
87 | INT_NUMBER@[160; 161) "1" | ||
88 | COMMA@[161; 162) | ||
89 | WHITESPACE@[162; 163) | ||
90 | PREFIX_EXPR@[163; 165) | ||
91 | MINUS@[163; 164) | ||
92 | LITERAL@[164; 165) | ||
93 | INT_NUMBER@[164; 165) "1" | ||
94 | R_PAREN@[165; 166) | ||
95 | R_PAREN@[166; 167) | ||
96 | WHITESPACE@[167; 168) | ||
97 | MATCH_ARM_LIST@[168; 222) | ||
98 | L_CURLY@[168; 169) | ||
99 | WHITESPACE@[169; 178) | ||
100 | MATCH_ARM@[178; 198) | ||
101 | TUPLE_STRUCT_PAT@[178; 192) | ||
102 | PATH@[178; 182) | ||
103 | PATH_SEGMENT@[178; 182) | ||
104 | NAME_REF@[178; 182) | ||
105 | IDENT@[178; 182) "Some" | ||
106 | L_PAREN@[182; 183) | ||
107 | TUPLE_PAT@[183; 191) | ||
108 | L_PAREN@[183; 184) | ||
109 | LITERAL_PAT@[184; 186) | ||
110 | MINUS@[184; 185) | ||
111 | LITERAL@[185; 186) | ||
112 | INT_NUMBER@[185; 186) "1" | ||
113 | COMMA@[186; 187) | ||
114 | WHITESPACE@[187; 188) | ||
115 | LITERAL_PAT@[188; 190) | ||
116 | MINUS@[188; 189) | ||
117 | LITERAL@[189; 190) | ||
118 | INT_NUMBER@[189; 190) "1" | ||
119 | R_PAREN@[190; 191) | ||
120 | R_PAREN@[191; 192) | ||
121 | WHITESPACE@[192; 193) | ||
122 | FAT_ARROW@[193; 195) | ||
123 | WHITESPACE@[195; 196) | ||
124 | TUPLE_EXPR@[196; 198) | ||
125 | L_PAREN@[196; 197) | ||
126 | R_PAREN@[197; 198) | ||
127 | COMMA@[198; 199) | ||
128 | WHITESPACE@[199; 208) | ||
129 | MATCH_ARM@[208; 215) | ||
130 | PLACEHOLDER_PAT@[208; 209) | ||
131 | UNDERSCORE@[208; 209) | ||
132 | WHITESPACE@[209; 210) | ||
133 | FAT_ARROW@[210; 212) | ||
134 | WHITESPACE@[212; 213) | ||
135 | TUPLE_EXPR@[213; 215) | ||
136 | L_PAREN@[213; 214) | ||
137 | R_PAREN@[214; 215) | ||
138 | COMMA@[215; 216) | ||
139 | WHITESPACE@[216; 221) | ||
140 | R_CURLY@[221; 222) | ||
141 | WHITESPACE@[222; 228) | ||
142 | EXPR_STMT@[228; 299) | ||
143 | MATCH_EXPR@[228; 299) | ||
144 | MATCH_KW@[228; 233) | ||
145 | WHITESPACE@[233; 234) | ||
146 | CALL_EXPR@[234; 246) | ||
147 | PATH_EXPR@[234; 238) | ||
148 | PATH@[234; 238) | ||
149 | PATH@[234; 235) | ||
150 | PATH_SEGMENT@[234; 235) | ||
151 | NAME_REF@[234; 235) | ||
152 | IDENT@[234; 235) "A" | ||
153 | COLONCOLON@[235; 237) | ||
154 | PATH_SEGMENT@[237; 238) | ||
155 | NAME_REF@[237; 238) | ||
156 | IDENT@[237; 238) "B" | ||
157 | ARG_LIST@[238; 246) | ||
158 | L_PAREN@[238; 239) | ||
159 | PREFIX_EXPR@[239; 241) | ||
160 | MINUS@[239; 240) | ||
161 | LITERAL@[240; 241) | ||
162 | INT_NUMBER@[240; 241) "1" | ||
163 | COMMA@[241; 242) | ||
164 | WHITESPACE@[242; 243) | ||
165 | PREFIX_EXPR@[243; 245) | ||
166 | MINUS@[243; 244) | ||
167 | LITERAL@[244; 245) | ||
168 | INT_NUMBER@[244; 245) "1" | ||
169 | R_PAREN@[245; 246) | ||
170 | WHITESPACE@[246; 247) | ||
171 | MATCH_ARM_LIST@[247; 299) | ||
172 | L_CURLY@[247; 248) | ||
173 | WHITESPACE@[248; 257) | ||
174 | MATCH_ARM@[257; 275) | ||
175 | TUPLE_STRUCT_PAT@[257; 269) | ||
176 | PATH@[257; 261) | ||
177 | PATH@[257; 258) | ||
178 | PATH_SEGMENT@[257; 258) | ||
179 | NAME_REF@[257; 258) | ||
180 | IDENT@[257; 258) "A" | ||
181 | COLONCOLON@[258; 260) | ||
182 | PATH_SEGMENT@[260; 261) | ||
183 | NAME_REF@[260; 261) | ||
184 | IDENT@[260; 261) "B" | ||
185 | L_PAREN@[261; 262) | ||
186 | LITERAL_PAT@[262; 264) | ||
187 | MINUS@[262; 263) | ||
188 | LITERAL@[263; 264) | ||
189 | INT_NUMBER@[263; 264) "1" | ||
190 | COMMA@[264; 265) | ||
191 | WHITESPACE@[265; 266) | ||
192 | LITERAL_PAT@[266; 268) | ||
193 | MINUS@[266; 267) | ||
194 | LITERAL@[267; 268) | ||
195 | INT_NUMBER@[267; 268) "1" | ||
196 | R_PAREN@[268; 269) | ||
197 | WHITESPACE@[269; 270) | ||
198 | FAT_ARROW@[270; 272) | ||
199 | WHITESPACE@[272; 273) | ||
200 | TUPLE_EXPR@[273; 275) | ||
201 | L_PAREN@[273; 274) | ||
202 | R_PAREN@[274; 275) | ||
203 | COMMA@[275; 276) | ||
204 | WHITESPACE@[276; 285) | ||
205 | MATCH_ARM@[285; 292) | ||
206 | PLACEHOLDER_PAT@[285; 286) | ||
207 | UNDERSCORE@[285; 286) | ||
208 | WHITESPACE@[286; 287) | ||
209 | FAT_ARROW@[287; 289) | ||
210 | WHITESPACE@[289; 290) | ||
211 | TUPLE_EXPR@[290; 292) | ||
212 | L_PAREN@[290; 291) | ||
213 | R_PAREN@[291; 292) | ||
214 | COMMA@[292; 293) | ||
215 | WHITESPACE@[293; 298) | ||
216 | R_CURLY@[298; 299) | ||
217 | WHITESPACE@[299; 305) | ||
218 | IF_EXPR@[305; 339) | ||
219 | IF_KW@[305; 307) | ||
220 | WHITESPACE@[307; 308) | ||
221 | CONDITION@[308; 331) | ||
222 | LET_KW@[308; 311) | ||
223 | WHITESPACE@[311; 312) | ||
224 | TUPLE_STRUCT_PAT@[312; 320) | ||
225 | PATH@[312; 316) | ||
226 | PATH_SEGMENT@[312; 316) | ||
227 | NAME_REF@[312; 316) | ||
228 | IDENT@[312; 316) "Some" | ||
229 | L_PAREN@[316; 317) | ||
230 | LITERAL_PAT@[317; 319) | ||
231 | MINUS@[317; 318) | ||
232 | LITERAL@[318; 319) | ||
233 | INT_NUMBER@[318; 319) "1" | ||
234 | R_PAREN@[319; 320) | ||
235 | WHITESPACE@[320; 321) | ||
236 | EQ@[321; 322) | ||
237 | WHITESPACE@[322; 323) | ||
238 | CALL_EXPR@[323; 331) | ||
239 | PATH_EXPR@[323; 327) | ||
240 | PATH@[323; 327) | ||
241 | PATH_SEGMENT@[323; 327) | ||
242 | NAME_REF@[323; 327) | ||
243 | IDENT@[323; 327) "Some" | ||
244 | ARG_LIST@[327; 331) | ||
245 | L_PAREN@[327; 328) | ||
246 | PREFIX_EXPR@[328; 330) | ||
247 | MINUS@[328; 329) | ||
248 | LITERAL@[329; 330) | ||
249 | INT_NUMBER@[329; 330) "1" | ||
250 | R_PAREN@[330; 331) | ||
251 | WHITESPACE@[331; 332) | ||
252 | BLOCK@[332; 339) | ||
253 | L_CURLY@[332; 333) | ||
254 | WHITESPACE@[333; 338) | ||
255 | R_CURLY@[338; 339) | ||
256 | WHITESPACE@[339; 340) | ||
257 | R_CURLY@[340; 341) | ||
258 | WHITESPACE@[341; 343) | ||
259 | ENUM_DEF@[343; 367) | ||
260 | ENUM_KW@[343; 347) | ||
261 | WHITESPACE@[347; 348) | ||
262 | NAME@[348; 349) | ||
263 | IDENT@[348; 349) "A" | ||
264 | WHITESPACE@[349; 350) | ||
265 | ENUM_VARIANT_LIST@[350; 367) | ||
266 | L_CURLY@[350; 351) | ||
267 | WHITESPACE@[351; 356) | ||
268 | ENUM_VARIANT@[356; 365) | ||
269 | NAME@[356; 357) | ||
270 | IDENT@[356; 357) "B" | ||
271 | POS_FIELD_DEF_LIST@[357; 365) | ||
272 | L_PAREN@[357; 358) | ||
273 | POS_FIELD_DEF@[358; 360) | ||
274 | PATH_TYPE@[358; 360) | ||
275 | PATH@[358; 360) | ||
276 | PATH_SEGMENT@[358; 360) | ||
277 | NAME_REF@[358; 360) | ||
278 | IDENT@[358; 360) "i8" | ||
279 | COMMA@[360; 361) | ||
280 | WHITESPACE@[361; 362) | ||
281 | POS_FIELD_DEF@[362; 364) | ||
282 | PATH_TYPE@[362; 364) | ||
283 | PATH@[362; 364) | ||
284 | PATH_SEGMENT@[362; 364) | ||
285 | NAME_REF@[362; 364) | ||
286 | IDENT@[362; 364) "i8" | ||
287 | R_PAREN@[364; 365) | ||
288 | WHITESPACE@[365; 366) | ||
289 | R_CURLY@[366; 367) | ||
290 | WHITESPACE@[367; 369) | ||
291 | FN_DEF@[369; 394) | ||
292 | FN_KW@[369; 371) | ||
293 | WHITESPACE@[371; 372) | ||
294 | NAME@[372; 375) | ||
295 | IDENT@[372; 375) "foo" | ||
296 | PARAM_LIST@[375; 391) | ||
297 | L_PAREN@[375; 376) | ||
298 | PARAM@[376; 390) | ||
299 | RANGE_PAT@[376; 386) | ||
300 | LITERAL_PAT@[376; 380) | ||
301 | MINUS@[376; 377) | ||
302 | LITERAL@[377; 380) | ||
303 | INT_NUMBER@[377; 380) "128" | ||
304 | DOTDOTEQ@[380; 383) | ||
305 | LITERAL_PAT@[383; 386) | ||
306 | LITERAL@[383; 386) | ||
307 | INT_NUMBER@[383; 386) "127" | ||
308 | COLON@[386; 387) | ||
309 | WHITESPACE@[387; 388) | ||
310 | PATH_TYPE@[388; 390) | ||
311 | PATH@[388; 390) | ||
312 | PATH_SEGMENT@[388; 390) | ||
313 | NAME_REF@[388; 390) | ||
314 | IDENT@[388; 390) "i8" | ||
315 | R_PAREN@[390; 391) | ||
316 | WHITESPACE@[391; 392) | ||
317 | BLOCK@[392; 394) | ||
318 | L_CURLY@[392; 393) | ||
319 | R_CURLY@[393; 394) | ||
320 | WHITESPACE@[394; 395) | ||