diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-20 15:30:36 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-20 15:30:36 +0000 |
commit | cfc50ff160d0af2ce5cd931c6d41161abfdb2fbd (patch) | |
tree | 35a9048f1f6f7a7e948faf2f337dd7973ab3427b /crates/ra_syntax/test_data/parser | |
parent | af5e2abe15c2bf182b871e26a680507a51526176 (diff) | |
parent | 4a7e19946a60b4cba6ef9d9916ae0fbec65c74da (diff) |
Merge #2615
2615: Fix wrong path parsing for macro call in pattern position r=edwin0cheng a=edwin0cheng
The parser incorrectly insert a `PathPat` inside `MacroCall` syntax node when parsing inside a pattern position, for example :
```rust
let foo!() = 0;
```
become:
```
MACRO_CALL@[60; 66)
PATH_PAT@[60; 63) <------------- It should not exist
PATH@[60; 63)
PATH_SEGMENT@[60; 63)
NAME_REF@[60; 63)
IDENT@[60; 63) "foo"
EXCL@[63; 64) "!"
TOKEN_TREE@[64; 66)
L_PAREN@[64; 65) "("
R_PAREN@[65; 66) ")"
```
This PR fix this bug and add some test to make sure goto-defintion works for macro inside pattern.
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_syntax/test_data/parser')
-rw-r--r-- | crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.txt | 9 |
1 files changed, 4 insertions, 5 deletions
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 4a714ad6b..b05ccc0ed 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 | |||
@@ -16,11 +16,10 @@ SOURCE_FILE@[0; 33) | |||
16 | LET_KW@[16; 19) "let" | 16 | LET_KW@[16; 19) "let" |
17 | WHITESPACE@[19; 20) " " | 17 | WHITESPACE@[19; 20) " " |
18 | MACRO_CALL@[20; 25) | 18 | MACRO_CALL@[20; 25) |
19 | PATH_PAT@[20; 21) | 19 | PATH@[20; 21) |
20 | PATH@[20; 21) | 20 | PATH_SEGMENT@[20; 21) |
21 | PATH_SEGMENT@[20; 21) | 21 | NAME_REF@[20; 21) |
22 | NAME_REF@[20; 21) | 22 | IDENT@[20; 21) "m" |
23 | IDENT@[20; 21) "m" | ||
24 | EXCL@[21; 22) "!" | 23 | EXCL@[21; 22) "!" |
25 | TOKEN_TREE@[22; 25) | 24 | TOKEN_TREE@[22; 25) |
26 | L_PAREN@[22; 23) "(" | 25 | L_PAREN@[22; 23) "(" |