diff options
Diffstat (limited to 'crates/libsyntax2/tests')
3 files changed, 135 insertions, 146 deletions
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 58e39a341..c4d9f5e7e 100644 --- a/crates/libsyntax2/tests/data/parser/err/0018_incomplete_fn.txt +++ b/crates/libsyntax2/tests/data/parser/err/0018_incomplete_fn.txt | |||
@@ -11,168 +11,121 @@ 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; 180) | 14 | FN_DEF@[20; 161) |
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; 180) | 19 | PARAM_LIST@[32; 35) |
20 | L_PAREN@[32; 33) | 20 | L_PAREN@[32; 33) |
21 | PARAM@[33; 38) | 21 | PARAM@[33; 34) |
22 | REF_PAT@[33; 35) | 22 | REF_PAT@[33; 34) |
23 | AMP@[33; 34) | 23 | AMP@[33; 34) |
24 | err: `expected pattern` | 24 | err: `expected pattern` |
25 | ERROR@[34; 35) | 25 | err: `expected COLON` |
26 | R_PAREN@[34; 35) | 26 | err: `expected type` |
27 | err: `expected COLON` | 27 | R_PAREN@[34; 35) |
28 | WHITESPACE@[35; 36) | 28 | WHITESPACE@[35; 36) |
29 | err: `expected type` | 29 | RET_TYPE@[36; 46) |
30 | ERROR@[36; 38) | 30 | THIN_ARROW@[36; 38) |
31 | THIN_ARROW@[36; 38) | ||
32 | err: `expected COMMA` | ||
33 | WHITESPACE@[38; 39) | 31 | WHITESPACE@[38; 39) |
34 | PARAM@[39; 169) | 32 | PATH_TYPE@[39; 46) |
35 | STRUCT_PAT@[39; 161) | 33 | PATH@[39; 46) |
36 | PATH@[39; 46) | 34 | PATH_SEGMENT@[39; 46) |
37 | PATH_SEGMENT@[39; 46) | 35 | NAME_REF@[39; 46) |
38 | NAME_REF@[39; 46) | 36 | IDENT@[39; 46) "ScopeId" |
39 | IDENT@[39; 46) "ScopeId" | 37 | WHITESPACE@[46; 47) |
40 | WHITESPACE@[46; 47) | 38 | BLOCK@[47; 161) |
41 | FIELD_PAT_LIST@[47; 161) | 39 | L_CURLY@[47; 48) |
42 | L_CURLY@[47; 48) | 40 | WHITESPACE@[48; 57) |
43 | WHITESPACE@[48; 57) | 41 | LET_STMT@[57; 85) |
44 | err: `expected a name` | 42 | LET_KW@[57; 60) |
45 | BIND_PAT@[57; 60) | 43 | WHITESPACE@[60; 61) |
46 | ERROR@[57; 60) | 44 | BIND_PAT@[61; 64) |
47 | LET_KW@[57; 60) | 45 | NAME@[61; 64) |
48 | err: `expected COMMA` | 46 | IDENT@[61; 64) "res" |
49 | WHITESPACE@[60; 61) | 47 | WHITESPACE@[64; 65) |
50 | BIND_PAT@[61; 64) | 48 | EQ@[65; 66) |
51 | NAME@[61; 64) | 49 | WHITESPACE@[66; 67) |
52 | IDENT@[61; 64) "res" | 50 | METHOD_CALL_EXPR@[67; 84) |
53 | err: `expected COMMA` | 51 | FIELD_EXPR@[67; 78) |
54 | WHITESPACE@[64; 65) | 52 | PATH_EXPR@[67; 71) |
55 | err: `expected a name` | 53 | PATH@[67; 71) |
56 | BIND_PAT@[65; 66) | 54 | PATH_SEGMENT@[67; 71) |
57 | ERROR@[65; 66) | 55 | SELF_KW@[67; 71) |
58 | EQ@[65; 66) | 56 | DOT@[71; 72) |
59 | err: `expected COMMA` | 57 | NAME_REF@[72; 78) |
60 | WHITESPACE@[66; 67) | 58 | IDENT@[72; 78) "scopes" |
61 | err: `expected a name` | 59 | DOT@[78; 79) |
62 | BIND_PAT@[67; 71) | 60 | NAME_REF@[79; 82) |
63 | ERROR@[67; 71) | 61 | IDENT@[79; 82) "len" |
64 | SELF_KW@[67; 71) | 62 | ARG_LIST@[82; 84) |
65 | err: `expected COMMA` | 63 | L_PAREN@[82; 83) |
66 | err: `expected a name` | 64 | R_PAREN@[83; 84) |
67 | BIND_PAT@[71; 72) | 65 | SEMI@[84; 85) |
68 | ERROR@[71; 72) | 66 | WHITESPACE@[85; 94) |
69 | DOT@[71; 72) | 67 | METHOD_CALL_EXPR@[94; 155) |
70 | err: `expected COMMA` | 68 | FIELD_EXPR@[94; 105) |
71 | BIND_PAT@[72; 78) | 69 | PATH_EXPR@[94; 98) |
72 | NAME@[72; 78) | 70 | PATH@[94; 98) |
73 | IDENT@[72; 78) "scopes" | 71 | PATH_SEGMENT@[94; 98) |
74 | err: `expected COMMA` | ||
75 | err: `expected a name` | ||
76 | BIND_PAT@[78; 79) | ||
77 | ERROR@[78; 79) | ||
78 | DOT@[78; 79) | ||
79 | err: `expected COMMA` | ||
80 | BIND_PAT@[79; 82) | ||
81 | NAME@[79; 82) | ||
82 | IDENT@[79; 82) "len" | ||
83 | err: `expected COMMA` | ||
84 | err: `expected a name` | ||
85 | BIND_PAT@[82; 83) | ||
86 | ERROR@[82; 83) | ||
87 | L_PAREN@[82; 83) | ||
88 | err: `expected COMMA` | ||
89 | err: `expected a name` | ||
90 | BIND_PAT@[83; 84) | ||
91 | ERROR@[83; 84) | ||
92 | R_PAREN@[83; 84) | ||
93 | err: `expected COMMA` | ||
94 | err: `expected a name` | ||
95 | BIND_PAT@[84; 85) | ||
96 | ERROR@[84; 85) | ||
97 | SEMI@[84; 85) | ||
98 | err: `expected COMMA` | ||
99 | WHITESPACE@[85; 94) | ||
100 | err: `expected a name` | ||
101 | BIND_PAT@[94; 98) | ||
102 | ERROR@[94; 98) | ||
103 | SELF_KW@[94; 98) | 72 | SELF_KW@[94; 98) |
104 | err: `expected COMMA` | 73 | DOT@[98; 99) |
105 | err: `expected a name` | 74 | NAME_REF@[99; 105) |
106 | BIND_PAT@[98; 99) | 75 | IDENT@[99; 105) "scopes" |
107 | ERROR@[98; 99) | 76 | DOT@[105; 106) |
108 | DOT@[98; 99) | 77 | NAME_REF@[106; 110) |
109 | err: `expected COMMA` | 78 | IDENT@[106; 110) "push" |
110 | BIND_PAT@[99; 105) | 79 | ARG_LIST@[110; 155) |
111 | NAME@[99; 105) | 80 | L_PAREN@[110; 111) |
112 | IDENT@[99; 105) "scopes" | 81 | STRUCT_LIT@[111; 154) |
113 | err: `expected COMMA` | 82 | PATH@[111; 120) |
114 | err: `expected a name` | 83 | PATH_SEGMENT@[111; 120) |
115 | BIND_PAT@[105; 106) | 84 | NAME_REF@[111; 120) |
116 | ERROR@[105; 106) | 85 | IDENT@[111; 120) "ScopeData" |
117 | DOT@[105; 106) | ||
118 | err: `expected COMMA` | ||
119 | BIND_PAT@[106; 110) | ||
120 | NAME@[106; 110) | ||
121 | IDENT@[106; 110) "push" | ||
122 | err: `expected COMMA` | ||
123 | err: `expected a name` | ||
124 | BIND_PAT@[110; 111) | ||
125 | ERROR@[110; 111) | ||
126 | L_PAREN@[110; 111) | ||
127 | err: `expected COMMA` | ||
128 | BIND_PAT@[111; 120) | ||
129 | NAME@[111; 120) | ||
130 | IDENT@[111; 120) "ScopeData" | ||
131 | err: `expected COMMA` | ||
132 | WHITESPACE@[120; 121) | 86 | WHITESPACE@[120; 121) |
133 | err: `expected ident` | 87 | NAMED_FIELD_LIST@[121; 154) |
134 | ERROR@[121; 154) | ||
135 | L_CURLY@[121; 122) | 88 | L_CURLY@[121; 122) |
136 | WHITESPACE@[122; 123) | 89 | WHITESPACE@[122; 123) |
137 | IDENT@[123; 129) "parent" | 90 | NAMED_FIELD@[123; 135) |
138 | COLON@[129; 130) | 91 | NAME_REF@[123; 129) |
139 | WHITESPACE@[130; 131) | 92 | IDENT@[123; 129) "parent" |
140 | IDENT@[131; 135) "None" | 93 | COLON@[129; 130) |
94 | WHITESPACE@[130; 131) | ||
95 | PATH_EXPR@[131; 135) | ||
96 | PATH@[131; 135) | ||
97 | PATH_SEGMENT@[131; 135) | ||
98 | NAME_REF@[131; 135) | ||
99 | IDENT@[131; 135) "None" | ||
141 | COMMA@[135; 136) | 100 | COMMA@[135; 136) |
142 | WHITESPACE@[136; 137) | 101 | WHITESPACE@[136; 137) |
143 | IDENT@[137; 144) "entries" | 102 | NAMED_FIELD@[137; 152) |
144 | COLON@[144; 145) | 103 | NAME_REF@[137; 144) |
145 | WHITESPACE@[145; 146) | 104 | IDENT@[137; 144) "entries" |
146 | IDENT@[146; 149) "vec" | 105 | COLON@[144; 145) |
147 | EXCL@[149; 150) | 106 | WHITESPACE@[145; 146) |
148 | L_BRACK@[150; 151) | 107 | MACRO_CALL@[146; 152) |
149 | R_BRACK@[151; 152) | 108 | PATH@[146; 149) |
109 | PATH_SEGMENT@[146; 149) | ||
110 | NAME_REF@[146; 149) | ||
111 | IDENT@[146; 149) "vec" | ||
112 | EXCL@[149; 150) | ||
113 | TOKEN_TREE@[150; 152) | ||
114 | L_BRACK@[150; 151) | ||
115 | R_BRACK@[151; 152) | ||
150 | WHITESPACE@[152; 153) | 116 | WHITESPACE@[152; 153) |
151 | R_CURLY@[153; 154) | 117 | R_CURLY@[153; 154) |
152 | err: `expected COMMA` | 118 | R_PAREN@[154; 155) |
153 | err: `expected a name` | 119 | WHITESPACE@[155; 160) |
154 | BIND_PAT@[154; 155) | 120 | R_CURLY@[160; 161) |
155 | ERROR@[154; 155) | 121 | WHITESPACE@[161; 167) |
156 | R_PAREN@[154; 155) | 122 | FN_DEF@[167; 180) |
157 | WHITESPACE@[155; 160) | 123 | FN_KW@[167; 169) |
158 | R_CURLY@[160; 161) | 124 | WHITESPACE@[169; 170) |
159 | err: `expected COLON` | 125 | NAME@[170; 180) |
160 | WHITESPACE@[161; 167) | 126 | IDENT@[170; 180) "set_parent" |
161 | FN_POINTER_TYPE@[167; 169) | 127 | err: `expected function arguments` |
162 | FN_KW@[167; 169) | 128 | err: `expected a block` |
163 | err: `expected parameters` | ||
164 | err: `expected COMMA` | ||
165 | WHITESPACE@[169; 170) | ||
166 | PARAM@[170; 180) | ||
167 | BIND_PAT@[170; 180) | ||
168 | NAME@[170; 180) | ||
169 | IDENT@[170; 180) "set_parent" | ||
170 | err: `expected COLON` | ||
171 | err: `expected type` | ||
172 | err: `expected COMMA` | ||
173 | err: `expected value parameter` | ||
174 | err: `expected R_PAREN` | ||
175 | err: `expected a block` | ||
176 | WHITESPACE@[180; 181) | 129 | WHITESPACE@[180; 181) |
177 | R_CURLY@[181; 182) | 130 | R_CURLY@[181; 182) |
178 | WHITESPACE@[182; 183) | 131 | WHITESPACE@[182; 183) |
diff --git a/crates/libsyntax2/tests/data/parser/err/0021_incomplete_param.rs b/crates/libsyntax2/tests/data/parser/err/0021_incomplete_param.rs new file mode 100644 index 000000000..7a6c264f6 --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/err/0021_incomplete_param.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | fn foo(x: i32, y) { | ||
2 | } | ||
diff --git a/crates/libsyntax2/tests/data/parser/err/0021_incomplete_param.txt b/crates/libsyntax2/tests/data/parser/err/0021_incomplete_param.txt new file mode 100644 index 000000000..8dcb58ae2 --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/err/0021_incomplete_param.txt | |||
@@ -0,0 +1,34 @@ | |||
1 | ROOT@[0; 22) | ||
2 | FN_DEF@[0; 21) | ||
3 | FN_KW@[0; 2) | ||
4 | WHITESPACE@[2; 3) | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 17) | ||
8 | L_PAREN@[6; 7) | ||
9 | PARAM@[7; 13) | ||
10 | BIND_PAT@[7; 8) | ||
11 | NAME@[7; 8) | ||
12 | IDENT@[7; 8) "x" | ||
13 | COLON@[8; 9) | ||
14 | WHITESPACE@[9; 10) | ||
15 | PATH_TYPE@[10; 13) | ||
16 | PATH@[10; 13) | ||
17 | PATH_SEGMENT@[10; 13) | ||
18 | NAME_REF@[10; 13) | ||
19 | IDENT@[10; 13) "i32" | ||
20 | COMMA@[13; 14) | ||
21 | WHITESPACE@[14; 15) | ||
22 | PARAM@[15; 16) | ||
23 | BIND_PAT@[15; 16) | ||
24 | NAME@[15; 16) | ||
25 | IDENT@[15; 16) "y" | ||
26 | err: `expected COLON` | ||
27 | err: `expected type` | ||
28 | R_PAREN@[16; 17) | ||
29 | WHITESPACE@[17; 18) | ||
30 | BLOCK@[18; 21) | ||
31 | L_CURLY@[18; 19) | ||
32 | WHITESPACE@[19; 20) | ||
33 | R_CURLY@[20; 21) | ||
34 | WHITESPACE@[21; 22) | ||