diff options
3 files changed, 118 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/grammar/expressions.rs b/crates/ra_syntax/src/grammar/expressions.rs index 7ee32fa7c..1604d9b5a 100644 --- a/crates/ra_syntax/src/grammar/expressions.rs +++ b/crates/ra_syntax/src/grammar/expressions.rs | |||
@@ -423,7 +423,7 @@ fn path_expr(p: &mut Parser, r: Restrictions) -> (CompletedMarker, BlockLike) { | |||
423 | match p.current() { | 423 | match p.current() { |
424 | L_CURLY if !r.forbid_structs => { | 424 | L_CURLY if !r.forbid_structs => { |
425 | named_field_list(p); | 425 | named_field_list(p); |
426 | (m.complete(p, STRUCT_LIT), BlockLike::Block) | 426 | (m.complete(p, STRUCT_LIT), BlockLike::NotBlock) |
427 | } | 427 | } |
428 | EXCL => { | 428 | EXCL => { |
429 | let block_like = items::macro_call_after_excl(p); | 429 | let block_like = items::macro_call_after_excl(p); |
diff --git a/crates/ra_syntax/tests/data/parser/ok/0043_complex_assignment.rs b/crates/ra_syntax/tests/data/parser/ok/0043_complex_assignment.rs new file mode 100644 index 000000000..7e4a28bf7 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/ok/0043_complex_assignment.rs | |||
@@ -0,0 +1,8 @@ | |||
1 | // https://github.com/rust-analyzer/rust-analyzer/issues/674 | ||
2 | |||
3 | struct Repr { raw: [u8; 1] } | ||
4 | |||
5 | fn abc() { | ||
6 | Repr { raw: [0] }.raw[0] = 0; | ||
7 | Repr{raw:[0]}(); | ||
8 | } | ||
diff --git a/crates/ra_syntax/tests/data/parser/ok/0043_complex_assignment.txt b/crates/ra_syntax/tests/data/parser/ok/0043_complex_assignment.txt new file mode 100644 index 000000000..2279c7966 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/ok/0043_complex_assignment.txt | |||
@@ -0,0 +1,109 @@ | |||
1 | SOURCE_FILE@[0; 160) | ||
2 | COMMENT@[0; 60) | ||
3 | WHITESPACE@[60; 62) | ||
4 | STRUCT_DEF@[62; 90) | ||
5 | STRUCT_KW@[62; 68) | ||
6 | WHITESPACE@[68; 69) | ||
7 | NAME@[69; 73) | ||
8 | IDENT@[69; 73) "Repr" | ||
9 | WHITESPACE@[73; 74) | ||
10 | NAMED_FIELD_DEF_LIST@[74; 90) | ||
11 | L_CURLY@[74; 75) | ||
12 | WHITESPACE@[75; 76) | ||
13 | NAMED_FIELD_DEF@[76; 88) | ||
14 | NAME@[76; 79) | ||
15 | IDENT@[76; 79) "raw" | ||
16 | COLON@[79; 80) | ||
17 | WHITESPACE@[80; 81) | ||
18 | ARRAY_TYPE@[81; 88) | ||
19 | L_BRACK@[81; 82) | ||
20 | PATH_TYPE@[82; 84) | ||
21 | PATH@[82; 84) | ||
22 | PATH_SEGMENT@[82; 84) | ||
23 | NAME_REF@[82; 84) | ||
24 | IDENT@[82; 84) "u8" | ||
25 | SEMI@[84; 85) | ||
26 | WHITESPACE@[85; 86) | ||
27 | LITERAL@[86; 87) | ||
28 | INT_NUMBER@[86; 87) "1" | ||
29 | R_BRACK@[87; 88) | ||
30 | WHITESPACE@[88; 89) | ||
31 | R_CURLY@[89; 90) | ||
32 | WHITESPACE@[90; 92) | ||
33 | FN_DEF@[92; 159) | ||
34 | FN_KW@[92; 94) | ||
35 | WHITESPACE@[94; 95) | ||
36 | NAME@[95; 98) | ||
37 | IDENT@[95; 98) "abc" | ||
38 | PARAM_LIST@[98; 100) | ||
39 | L_PAREN@[98; 99) | ||
40 | R_PAREN@[99; 100) | ||
41 | WHITESPACE@[100; 101) | ||
42 | BLOCK@[101; 159) | ||
43 | L_CURLY@[101; 102) | ||
44 | WHITESPACE@[102; 107) | ||
45 | EXPR_STMT@[107; 136) | ||
46 | BIN_EXPR@[107; 135) | ||
47 | INDEX_EXPR@[107; 131) | ||
48 | FIELD_EXPR@[107; 128) | ||
49 | STRUCT_LIT@[107; 124) | ||
50 | PATH@[107; 111) | ||
51 | PATH_SEGMENT@[107; 111) | ||
52 | NAME_REF@[107; 111) | ||
53 | IDENT@[107; 111) "Repr" | ||
54 | WHITESPACE@[111; 112) | ||
55 | NAMED_FIELD_LIST@[112; 124) | ||
56 | L_CURLY@[112; 113) | ||
57 | WHITESPACE@[113; 114) | ||
58 | NAMED_FIELD@[114; 122) | ||
59 | NAME_REF@[114; 117) | ||
60 | IDENT@[114; 117) "raw" | ||
61 | COLON@[117; 118) | ||
62 | WHITESPACE@[118; 119) | ||
63 | ARRAY_EXPR@[119; 122) | ||
64 | L_BRACK@[119; 120) | ||
65 | LITERAL@[120; 121) | ||
66 | INT_NUMBER@[120; 121) "0" | ||
67 | R_BRACK@[121; 122) | ||
68 | WHITESPACE@[122; 123) | ||
69 | R_CURLY@[123; 124) | ||
70 | DOT@[124; 125) | ||
71 | NAME_REF@[125; 128) | ||
72 | IDENT@[125; 128) "raw" | ||
73 | L_BRACK@[128; 129) | ||
74 | LITERAL@[129; 130) | ||
75 | INT_NUMBER@[129; 130) "0" | ||
76 | R_BRACK@[130; 131) | ||
77 | WHITESPACE@[131; 132) | ||
78 | EQ@[132; 133) | ||
79 | WHITESPACE@[133; 134) | ||
80 | LITERAL@[134; 135) | ||
81 | INT_NUMBER@[134; 135) "0" | ||
82 | SEMI@[135; 136) | ||
83 | WHITESPACE@[136; 141) | ||
84 | EXPR_STMT@[141; 157) | ||
85 | CALL_EXPR@[141; 156) | ||
86 | STRUCT_LIT@[141; 154) | ||
87 | PATH@[141; 145) | ||
88 | PATH_SEGMENT@[141; 145) | ||
89 | NAME_REF@[141; 145) | ||
90 | IDENT@[141; 145) "Repr" | ||
91 | NAMED_FIELD_LIST@[145; 154) | ||
92 | L_CURLY@[145; 146) | ||
93 | NAMED_FIELD@[146; 153) | ||
94 | NAME_REF@[146; 149) | ||
95 | IDENT@[146; 149) "raw" | ||
96 | COLON@[149; 150) | ||
97 | ARRAY_EXPR@[150; 153) | ||
98 | L_BRACK@[150; 151) | ||
99 | LITERAL@[151; 152) | ||
100 | INT_NUMBER@[151; 152) "0" | ||
101 | R_BRACK@[152; 153) | ||
102 | R_CURLY@[153; 154) | ||
103 | ARG_LIST@[154; 156) | ||
104 | L_PAREN@[154; 155) | ||
105 | R_PAREN@[155; 156) | ||
106 | SEMI@[156; 157) | ||
107 | WHITESPACE@[157; 158) | ||
108 | R_CURLY@[158; 159) | ||
109 | WHITESPACE@[159; 160) | ||