diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-15 20:15:29 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-15 20:15:29 +0000 |
commit | 86469d4195e7aeb93ae420d0c073593bfccc97f0 (patch) | |
tree | a2fd2d9a7be1b3310b842020c489197ebf2683c3 /crates/ra_syntax/test_data/parser/err | |
parent | 9c3e35df3327e4798867a005d8d22daca99825a1 (diff) | |
parent | 5645c153e0379874d1f44ab149c3ec9257812692 (diff) |
Merge #2252
2252: Fix parsing of "postfix" range expressions. r=matklad a=goffrie
Right now they are handled in `postfix_dot_expr`, but that doesn't allow it to
correctly handle precedence. Integrate it more tightly with the Pratt parser
instead.
Also includes a drive-by fix for parsing `match .. {}`.
Fixes #2242.
Co-authored-by: Geoffry Song <[email protected]>
Diffstat (limited to 'crates/ra_syntax/test_data/parser/err')
-rw-r--r-- | crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rs | 4 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.txt | 30 |
2 files changed, 34 insertions, 0 deletions
diff --git a/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rs b/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rs new file mode 100644 index 000000000..0b4ed7a2b --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | fn main() { | ||
2 | 0..=; | ||
3 | ..=; | ||
4 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.txt b/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.txt new file mode 100644 index 000000000..3810b9680 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.txt | |||
@@ -0,0 +1,30 @@ | |||
1 | SOURCE_FILE@[0; 33) | ||
2 | FN_DEF@[0; 32) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 7) | ||
6 | IDENT@[3; 7) "main" | ||
7 | PARAM_LIST@[7; 9) | ||
8 | L_PAREN@[7; 8) "(" | ||
9 | R_PAREN@[8; 9) ")" | ||
10 | WHITESPACE@[9; 10) " " | ||
11 | BLOCK_EXPR@[10; 32) | ||
12 | BLOCK@[10; 32) | ||
13 | L_CURLY@[10; 11) "{" | ||
14 | WHITESPACE@[11; 16) "\n " | ||
15 | EXPR_STMT@[16; 21) | ||
16 | RANGE_EXPR@[16; 20) | ||
17 | LITERAL@[16; 17) | ||
18 | INT_NUMBER@[16; 17) "0" | ||
19 | DOTDOTEQ@[17; 20) "..=" | ||
20 | SEMI@[20; 21) ";" | ||
21 | WHITESPACE@[21; 26) "\n " | ||
22 | EXPR_STMT@[26; 30) | ||
23 | RANGE_EXPR@[26; 29) | ||
24 | DOTDOTEQ@[26; 29) "..=" | ||
25 | SEMI@[29; 30) ";" | ||
26 | WHITESPACE@[30; 31) "\n" | ||
27 | R_CURLY@[31; 32) "}" | ||
28 | WHITESPACE@[32; 33) "\n" | ||
29 | error [16; 20): An inclusive range must have an end expression | ||
30 | error [26; 29): An inclusive range must have an end expression | ||