diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-03-07 09:57:04 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-03-07 09:57:04 +0000 |
commit | b94e1eee8341cb2a16b89711d65b382549fd2bde (patch) | |
tree | 6d7d8c3e6ccc95a7f9a7c4398516393ff2786623 /crates/ra_ide_api/src/hover.rs | |
parent | b1a1d20e067c25fb80fbab43b2956b6747a8dd3c (diff) | |
parent | 064707c5a05e360d777b0b3ccbd8e30ad4acbda1 (diff) |
Merge #942
942: Hover for associated items in patterns r=matklad a=kjeremy
Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/hover.rs')
-rw-r--r-- | crates/ra_ide_api/src/hover.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index bcd052c8b..638c24e31 100644 --- a/crates/ra_ide_api/src/hover.rs +++ b/crates/ra_ide_api/src/hover.rs | |||
@@ -534,4 +534,27 @@ mod tests { | |||
534 | assert_eq!(trim_markup_opt(hover.info.first()), Some("fn new() -> Thing")); | 534 | assert_eq!(trim_markup_opt(hover.info.first()), Some("fn new() -> Thing")); |
535 | assert_eq!(hover.info.is_exact(), true); | 535 | assert_eq!(hover.info.is_exact(), true); |
536 | } | 536 | } |
537 | |||
538 | #[test] | ||
539 | fn test_hover_infer_associated_const_in_pattern() { | ||
540 | let (analysis, position) = single_file_with_position( | ||
541 | " | ||
542 | struct X; | ||
543 | impl X { | ||
544 | const C: u32 = 1; | ||
545 | } | ||
546 | |||
547 | fn main() { | ||
548 | match 1 { | ||
549 | X::C<|> => {}, | ||
550 | 2 => {}, | ||
551 | _ => {} | ||
552 | }; | ||
553 | } | ||
554 | ", | ||
555 | ); | ||
556 | let hover = analysis.hover(position).unwrap().unwrap(); | ||
557 | assert_eq!(trim_markup_opt(hover.info.first()), Some("const C: u32")); | ||
558 | assert_eq!(hover.info.is_exact(), true); | ||
559 | } | ||
537 | } | 560 | } |