From d6533994e461dac502672c77ff27c6ca08fdc092 Mon Sep 17 00:00:00 2001 From: csmoe Date: Tue, 18 Jun 2019 23:50:57 +0800 Subject: fix: box_pattern Change-Id: I45a856d74fb616d3bce33050f9e69d327186bd59 --- .../tests/data/parser/inline/ok/0112_bind_pat.rs | 1 + .../tests/data/parser/inline/ok/0112_bind_pat.txt | 41 ++++++++++++++++++---- .../tests/data/parser/inline/ok/0132_box_expr.rs | 3 ++ .../tests/data/parser/inline/ok/0132_box_expr.txt | 31 ++++++++++++++++ .../tests/data/parser/inline/ok/0132_box_syntax.rs | 3 -- 5 files changed, 70 insertions(+), 9 deletions(-) create mode 100644 crates/ra_syntax/tests/data/parser/inline/ok/0132_box_expr.rs create mode 100644 crates/ra_syntax/tests/data/parser/inline/ok/0132_box_expr.txt delete mode 100644 crates/ra_syntax/tests/data/parser/inline/ok/0132_box_syntax.rs (limited to 'crates/ra_syntax/tests/data/parser/inline/ok') diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0112_bind_pat.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0112_bind_pat.rs index 820a9e72c..5a93469af 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0112_bind_pat.rs +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0112_bind_pat.rs @@ -5,4 +5,5 @@ fn main() { let ref mut d = (); let e @ _ = (); let ref mut f @ g @ _ = (); + let box i = Box::new(1i32); } diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0112_bind_pat.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0112_bind_pat.txt index ab0f88507..189254a19 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0112_bind_pat.txt +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0112_bind_pat.txt @@ -1,5 +1,5 @@ -SOURCE_FILE@[0; 146) - FN_DEF@[0; 145) +SOURCE_FILE@[0; 178) + FN_DEF@[0; 177) FN_KW@[0; 2) "fn" WHITESPACE@[2; 3) " " NAME@[3; 7) @@ -8,7 +8,7 @@ SOURCE_FILE@[0; 146) L_PAREN@[7; 8) "(" R_PAREN@[8; 9) ")" WHITESPACE@[9; 10) " " - BLOCK@[10; 145) + BLOCK@[10; 177) L_CURLY@[10; 11) "{" WHITESPACE@[11; 16) "\n " LET_STMT@[16; 27) @@ -122,6 +122,35 @@ SOURCE_FILE@[0; 146) L_PAREN@[140; 141) "(" R_PAREN@[141; 142) ")" SEMI@[142; 143) ";" - WHITESPACE@[143; 144) "\n" - R_CURLY@[144; 145) "}" - WHITESPACE@[145; 146) "\n" + WHITESPACE@[143; 148) "\n " + LET_STMT@[148; 175) + LET_KW@[148; 151) "let" + WHITESPACE@[151; 152) " " + BIND_PAT@[152; 157) + BOX_KW@[152; 155) "box" + WHITESPACE@[155; 156) " " + NAME@[156; 157) + IDENT@[156; 157) "i" + WHITESPACE@[157; 158) " " + EQ@[158; 159) "=" + WHITESPACE@[159; 160) " " + CALL_EXPR@[160; 174) + PATH_EXPR@[160; 168) + PATH@[160; 168) + PATH@[160; 163) + PATH_SEGMENT@[160; 163) + NAME_REF@[160; 163) + IDENT@[160; 163) "Box" + COLONCOLON@[163; 165) "::" + PATH_SEGMENT@[165; 168) + NAME_REF@[165; 168) + IDENT@[165; 168) "new" + ARG_LIST@[168; 174) + L_PAREN@[168; 169) "(" + LITERAL@[169; 173) + INT_NUMBER@[169; 173) "1i32" + R_PAREN@[173; 174) ")" + SEMI@[174; 175) ";" + WHITESPACE@[175; 176) "\n" + R_CURLY@[176; 177) "}" + WHITESPACE@[177; 178) "\n" diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0132_box_expr.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0132_box_expr.rs new file mode 100644 index 000000000..e69c81e22 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0132_box_expr.rs @@ -0,0 +1,3 @@ +fn foo() { + let x = box 1i32; +} diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0132_box_expr.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0132_box_expr.txt new file mode 100644 index 000000000..f4eeb7e24 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0132_box_expr.txt @@ -0,0 +1,31 @@ +SOURCE_FILE@[0; 35) + FN_DEF@[0; 34) + FN_KW@[0; 2) "fn" + WHITESPACE@[2; 3) " " + NAME@[3; 6) + IDENT@[3; 6) "foo" + PARAM_LIST@[6; 8) + L_PAREN@[6; 7) "(" + R_PAREN@[7; 8) ")" + WHITESPACE@[8; 9) " " + BLOCK@[9; 34) + L_CURLY@[9; 10) "{" + WHITESPACE@[10; 15) "\n " + LET_STMT@[15; 32) + LET_KW@[15; 18) "let" + WHITESPACE@[18; 19) " " + BIND_PAT@[19; 20) + NAME@[19; 20) + IDENT@[19; 20) "x" + WHITESPACE@[20; 21) " " + EQ@[21; 22) "=" + WHITESPACE@[22; 23) " " + BOX_EXPR@[23; 31) + BOX_KW@[23; 26) "box" + WHITESPACE@[26; 27) " " + LITERAL@[27; 31) + INT_NUMBER@[27; 31) "1i32" + SEMI@[31; 32) ";" + WHITESPACE@[32; 33) "\n" + R_CURLY@[33; 34) "}" + WHITESPACE@[34; 35) "\n" diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0132_box_syntax.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0132_box_syntax.rs deleted file mode 100644 index e69c81e22..000000000 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0132_box_syntax.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn foo() { - let x = box 1i32; -} -- cgit v1.2.3