aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-12-20 15:11:07 +0000
committerEdwin Cheng <[email protected]>2019-12-20 15:26:04 +0000
commit4a7e19946a60b4cba6ef9d9916ae0fbec65c74da (patch)
tree35a9048f1f6f7a7e948faf2f337dd7973ab3427b /crates/ra_ide
parentaf5e2abe15c2bf182b871e26a680507a51526176 (diff)
Fix parser for macro call in pattern position
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/goto_definition.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs
index 9b5744789..79d332e8c 100644
--- a/crates/ra_ide/src/goto_definition.rs
+++ b/crates/ra_ide/src/goto_definition.rs
@@ -425,6 +425,42 @@ mod tests {
425 } 425 }
426 426
427 #[test] 427 #[test]
428 fn goto_definition_works_for_macro_inside_pattern() {
429 check_goto(
430 "
431 //- /lib.rs
432 macro_rules! foo {() => {0}}
433
434 fn bar() {
435 match (0,1) {
436 (<|>foo!(), _) => {}
437 }
438 }
439 ",
440 "foo MACRO_CALL FileId(1) [0; 28) [13; 16)",
441 "macro_rules! foo {() => {0}}|foo",
442 );
443 }
444
445 #[test]
446 fn goto_definition_works_for_macro_inside_match_arm_lhs() {
447 check_goto(
448 "
449 //- /lib.rs
450 macro_rules! foo {() => {0}}
451
452 fn bar() {
453 match 0 {
454 <|>foo!() => {}
455 }
456 }
457 ",
458 "foo MACRO_CALL FileId(1) [0; 28) [13; 16)",
459 "macro_rules! foo {() => {0}}|foo",
460 );
461 }
462
463 #[test]
428 fn goto_def_for_methods() { 464 fn goto_def_for_methods() {
429 covers!(goto_def_for_methods); 465 covers!(goto_def_for_methods);
430 check_goto( 466 check_goto(