diff options
Diffstat (limited to 'crates/libsyntax2/tests')
4 files changed, 54 insertions, 13 deletions
diff --git a/crates/libsyntax2/tests/data/parser/err/0017_incomplete_binexpr.txt b/crates/libsyntax2/tests/data/parser/err/0017_incomplete_binexpr.txt index db9a2f175..f0be287ad 100644 --- a/crates/libsyntax2/tests/data/parser/err/0017_incomplete_binexpr.txt +++ b/crates/libsyntax2/tests/data/parser/err/0017_incomplete_binexpr.txt | |||
@@ -35,13 +35,12 @@ ROOT@[0; 47) | |||
35 | INT_NUMBER@[33; 35) "92" | 35 | INT_NUMBER@[33; 35) "92" |
36 | SEMI@[35; 36) | 36 | SEMI@[35; 36) |
37 | WHITESPACE@[36; 41) | 37 | WHITESPACE@[36; 41) |
38 | BIN_EXPR@[41; 45) | 38 | BIN_EXPR@[41; 44) |
39 | LITERAL@[41; 42) | 39 | LITERAL@[41; 42) |
40 | INT_NUMBER@[41; 42) "1" | 40 | INT_NUMBER@[41; 42) "1" |
41 | WHITESPACE@[42; 43) | 41 | WHITESPACE@[42; 43) |
42 | PLUS@[43; 44) | 42 | PLUS@[43; 44) |
43 | WHITESPACE@[44; 45) | ||
44 | err: `expected expression` | 43 | err: `expected expression` |
45 | ERROR@[45; 45) | 44 | WHITESPACE@[44; 45) |
46 | R_CURLY@[45; 46) | 45 | R_CURLY@[45; 46) |
47 | WHITESPACE@[46; 47) | 46 | WHITESPACE@[46; 47) |
diff --git a/crates/libsyntax2/tests/data/parser/err/0018_incomplete_fn.txt b/crates/libsyntax2/tests/data/parser/err/0018_incomplete_fn.txt index 3f3a7784b..58e39a341 100644 --- a/crates/libsyntax2/tests/data/parser/err/0018_incomplete_fn.txt +++ b/crates/libsyntax2/tests/data/parser/err/0018_incomplete_fn.txt | |||
@@ -11,12 +11,12 @@ ROOT@[0; 183) | |||
11 | ITEM_LIST@[14; 182) | 11 | ITEM_LIST@[14; 182) |
12 | L_CURLY@[14; 15) | 12 | L_CURLY@[14; 15) |
13 | WHITESPACE@[15; 20) | 13 | WHITESPACE@[15; 20) |
14 | FN_DEF@[20; 181) | 14 | FN_DEF@[20; 180) |
15 | FN_KW@[20; 22) | 15 | FN_KW@[20; 22) |
16 | WHITESPACE@[22; 23) | 16 | WHITESPACE@[22; 23) |
17 | NAME@[23; 32) | 17 | NAME@[23; 32) |
18 | IDENT@[23; 32) "new_scope" | 18 | IDENT@[23; 32) "new_scope" |
19 | PARAM_LIST@[32; 181) | 19 | PARAM_LIST@[32; 180) |
20 | L_PAREN@[32; 33) | 20 | L_PAREN@[32; 33) |
21 | PARAM@[33; 38) | 21 | PARAM@[33; 38) |
22 | REF_PAT@[33; 35) | 22 | REF_PAT@[33; 35) |
@@ -163,17 +163,16 @@ ROOT@[0; 183) | |||
163 | err: `expected parameters` | 163 | err: `expected parameters` |
164 | err: `expected COMMA` | 164 | err: `expected COMMA` |
165 | WHITESPACE@[169; 170) | 165 | WHITESPACE@[169; 170) |
166 | PARAM@[170; 181) | 166 | PARAM@[170; 180) |
167 | BIND_PAT@[170; 180) | 167 | BIND_PAT@[170; 180) |
168 | NAME@[170; 180) | 168 | NAME@[170; 180) |
169 | IDENT@[170; 180) "set_parent" | 169 | IDENT@[170; 180) "set_parent" |
170 | err: `expected COLON` | 170 | err: `expected COLON` |
171 | WHITESPACE@[180; 181) | 171 | err: `expected type` |
172 | err: `expected type` | 172 | err: `expected COMMA` |
173 | err: `expected COMMA` | 173 | err: `expected value parameter` |
174 | err: `expected value parameter` | 174 | err: `expected R_PAREN` |
175 | err: `expected R_PAREN` | 175 | err: `expected a block` |
176 | err: `expected a block` | 176 | WHITESPACE@[180; 181) |
177 | ERROR@[181; 181) | ||
178 | R_CURLY@[181; 182) | 177 | R_CURLY@[181; 182) |
179 | WHITESPACE@[182; 183) | 178 | WHITESPACE@[182; 183) |
diff --git a/crates/libsyntax2/tests/data/parser/err/0019_let_recover.rs b/crates/libsyntax2/tests/data/parser/err/0019_let_recover.rs new file mode 100644 index 000000000..52bddd494 --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/err/0019_let_recover.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | fn foo() { | ||
2 | let foo = | ||
3 | let bar = 1; | ||
4 | } | ||
diff --git a/crates/libsyntax2/tests/data/parser/err/0019_let_recover.txt b/crates/libsyntax2/tests/data/parser/err/0019_let_recover.txt new file mode 100644 index 000000000..9ffa9d781 --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/err/0019_let_recover.txt | |||
@@ -0,0 +1,39 @@ | |||
1 | ROOT@[0; 44) | ||
2 | FN_DEF@[0; 43) | ||
3 | FN_KW@[0; 2) | ||
4 | WHITESPACE@[2; 3) | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 8) | ||
8 | L_PAREN@[6; 7) | ||
9 | R_PAREN@[7; 8) | ||
10 | WHITESPACE@[8; 9) | ||
11 | BLOCK@[9; 43) | ||
12 | L_CURLY@[9; 10) | ||
13 | WHITESPACE@[10; 15) | ||
14 | LET_STMT@[15; 24) | ||
15 | LET_KW@[15; 18) | ||
16 | WHITESPACE@[18; 19) | ||
17 | BIND_PAT@[19; 22) | ||
18 | NAME@[19; 22) | ||
19 | IDENT@[19; 22) "foo" | ||
20 | WHITESPACE@[22; 23) | ||
21 | EQ@[23; 24) | ||
22 | err: `expected expression` | ||
23 | err: `expected SEMI` | ||
24 | WHITESPACE@[24; 29) | ||
25 | LET_STMT@[29; 41) | ||
26 | LET_KW@[29; 32) | ||
27 | WHITESPACE@[32; 33) | ||
28 | BIND_PAT@[33; 36) | ||
29 | NAME@[33; 36) | ||
30 | IDENT@[33; 36) "bar" | ||
31 | WHITESPACE@[36; 37) | ||
32 | EQ@[37; 38) | ||
33 | WHITESPACE@[38; 39) | ||
34 | LITERAL@[39; 40) | ||
35 | INT_NUMBER@[39; 40) "1" | ||
36 | SEMI@[40; 41) | ||
37 | WHITESPACE@[41; 42) | ||
38 | R_CURLY@[42; 43) | ||
39 | WHITESPACE@[43; 44) | ||