aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan MacKenzie <[email protected]>2019-08-22 19:26:13 +0100
committerDylan MacKenzie <[email protected]>2019-08-22 20:53:54 +0100
commit3e14b16c4d67e6a87e21424dd56732b511724e04 (patch)
tree3419abf3750aefc3d36d143a663f265714fa2a4f
parentf3b320adf49ec4a11eaa31fbeda82e7de54586bd (diff)
Add test for nested box pattern
-rw-r--r--crates/ra_parser/src/grammar/expressions/atom.rs2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rs2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.txt59
3 files changed, 51 insertions, 12 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs
index bc942ae01..ab8fb9f6e 100644
--- a/crates/ra_parser/src/grammar/expressions/atom.rs
+++ b/crates/ra_parser/src/grammar/expressions/atom.rs
@@ -414,6 +414,8 @@ pub(crate) fn match_arm_list(p: &mut Parser) {
414// X | Y if Z => (), 414// X | Y if Z => (),
415// | X | Y if Z => (), 415// | X | Y if Z => (),
416// | X => (), 416// | X => (),
417// box X => (),
418// Some(box X) => (),
417// }; 419// };
418// } 420// }
419fn match_arm(p: &mut Parser) -> BlockLike { 421fn match_arm(p: &mut Parser) -> BlockLike {
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rs b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rs
index 9e009e24f..2d476278d 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rs
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rs
@@ -5,5 +5,7 @@ fn foo() {
5 X | Y if Z => (), 5 X | Y if Z => (),
6 | X | Y if Z => (), 6 | X | Y if Z => (),
7 | X => (), 7 | X => (),
8 box X => (),
9 Some(box X) => (),
8 }; 10 };
9} 11}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.txt b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.txt
index 041e7179e..28d501459 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 167) 1SOURCE_FILE@[0; 215)
2 FN_DEF@[0; 166) 2 FN_DEF@[0; 214)
3 FN_KW@[0; 2) "fn" 3 FN_KW@[0; 2) "fn"
4 WHITESPACE@[2; 3) " " 4 WHITESPACE@[2; 3) " "
5 NAME@[3; 6) 5 NAME@[3; 6)
@@ -8,18 +8,18 @@ SOURCE_FILE@[0; 167)
8 L_PAREN@[6; 7) "(" 8 L_PAREN@[6; 7) "("
9 R_PAREN@[7; 8) ")" 9 R_PAREN@[7; 8) ")"
10 WHITESPACE@[8; 9) " " 10 WHITESPACE@[8; 9) " "
11 BLOCK@[9; 166) 11 BLOCK@[9; 214)
12 L_CURLY@[9; 10) "{" 12 L_CURLY@[9; 10) "{"
13 WHITESPACE@[10; 15) "\n " 13 WHITESPACE@[10; 15) "\n "
14 EXPR_STMT@[15; 164) 14 EXPR_STMT@[15; 212)
15 MATCH_EXPR@[15; 163) 15 MATCH_EXPR@[15; 211)
16 MATCH_KW@[15; 20) "match" 16 MATCH_KW@[15; 20) "match"
17 WHITESPACE@[20; 21) " " 17 WHITESPACE@[20; 21) " "
18 TUPLE_EXPR@[21; 23) 18 TUPLE_EXPR@[21; 23)
19 L_PAREN@[21; 22) "(" 19 L_PAREN@[21; 22) "("
20 R_PAREN@[22; 23) ")" 20 R_PAREN@[22; 23) ")"
21 WHITESPACE@[23; 24) " " 21 WHITESPACE@[23; 24) " "
22 MATCH_ARM_LIST@[24; 163) 22 MATCH_ARM_LIST@[24; 211)
23 L_CURLY@[24; 25) "{" 23 L_CURLY@[24; 25) "{"
24 WHITESPACE@[25; 34) "\n " 24 WHITESPACE@[25; 34) "\n "
25 MATCH_ARM@[34; 41) 25 MATCH_ARM@[34; 41)
@@ -141,9 +141,44 @@ SOURCE_FILE@[0; 167)
141 L_PAREN@[154; 155) "(" 141 L_PAREN@[154; 155) "("
142 R_PAREN@[155; 156) ")" 142 R_PAREN@[155; 156) ")"
143 COMMA@[156; 157) "," 143 COMMA@[156; 157) ","
144 WHITESPACE@[157; 162) "\n " 144 WHITESPACE@[157; 166) "\n "
145 R_CURLY@[162; 163) "}" 145 MATCH_ARM@[166; 177)
146 SEMI@[163; 164) ";" 146 BIND_PAT@[166; 171)
147 WHITESPACE@[164; 165) "\n" 147 BOX_KW@[166; 169) "box"
148 R_CURLY@[165; 166) "}" 148 WHITESPACE@[169; 170) " "
149 WHITESPACE@[166; 167) "\n" 149 NAME@[170; 171)
150 IDENT@[170; 171) "X"
151 WHITESPACE@[171; 172) " "
152 FAT_ARROW@[172; 174) "=>"
153 WHITESPACE@[174; 175) " "
154 TUPLE_EXPR@[175; 177)
155 L_PAREN@[175; 176) "("
156 R_PAREN@[176; 177) ")"
157 COMMA@[177; 178) ","
158 WHITESPACE@[178; 187) "\n "
159 MATCH_ARM@[187; 204)
160 TUPLE_STRUCT_PAT@[187; 198)
161 PATH@[187; 191)
162 PATH_SEGMENT@[187; 191)
163 NAME_REF@[187; 191)
164 IDENT@[187; 191) "Some"
165 L_PAREN@[191; 192) "("
166 BIND_PAT@[192; 197)
167 BOX_KW@[192; 195) "box"
168 WHITESPACE@[195; 196) " "
169 NAME@[196; 197)
170 IDENT@[196; 197) "X"
171 R_PAREN@[197; 198) ")"
172 WHITESPACE@[198; 199) " "
173 FAT_ARROW@[199; 201) "=>"
174 WHITESPACE@[201; 202) " "
175 TUPLE_EXPR@[202; 204)
176 L_PAREN@[202; 203) "("
177 R_PAREN@[203; 204) ")"
178 COMMA@[204; 205) ","
179 WHITESPACE@[205; 210) "\n "
180 R_CURLY@[210; 211) "}"
181 SEMI@[211; 212) ";"
182 WHITESPACE@[212; 213) "\n"
183 R_CURLY@[213; 214) "}"
184 WHITESPACE@[214; 215) "\n"