From da8eb29a2f70a58122903bf087bd6c1d0fbd6d3f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 3 Apr 2020 15:38:42 +0200 Subject: Macro patterns are not confused with expressions. We treat macro calls as expressions (there's appropriate Into impl), which causes problem if there's expresison and non-expression macro in the same node (like in the match arm). We fix this problem by nesting macor patterns into another node (the same way we nest path into PathExpr or PathPat). Ideally, we probably should add a similar nesting for macro expressions, but that needs some careful thinking about macros in blocks: `{ am_i_expression!() }`. --- .../test_data/parser/inline/ok/0129_marco_pat.txt | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'crates/ra_syntax/test_data/parser/inline/ok') diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.txt b/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.txt index b05ccc0ed..36d8f4a5f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.txt @@ -15,16 +15,17 @@ SOURCE_FILE@[0; 33) LET_STMT@[16; 30) LET_KW@[16; 19) "let" WHITESPACE@[19; 20) " " - MACRO_CALL@[20; 25) - PATH@[20; 21) - PATH_SEGMENT@[20; 21) - NAME_REF@[20; 21) - IDENT@[20; 21) "m" - EXCL@[21; 22) "!" - TOKEN_TREE@[22; 25) - L_PAREN@[22; 23) "(" - IDENT@[23; 24) "x" - R_PAREN@[24; 25) ")" + MACRO_PAT@[20; 25) + MACRO_CALL@[20; 25) + PATH@[20; 21) + PATH_SEGMENT@[20; 21) + NAME_REF@[20; 21) + IDENT@[20; 21) "m" + EXCL@[21; 22) "!" + TOKEN_TREE@[22; 25) + L_PAREN@[22; 23) "(" + IDENT@[23; 24) "x" + R_PAREN@[24; 25) ")" WHITESPACE@[25; 26) " " EQ@[26; 27) "=" WHITESPACE@[27; 28) " " -- cgit v1.2.3