about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crates/ide/src/call_hierarchy.rs27
1 files changed, 26 insertions, 1 deletions
diff --git a/crates/ide/src/call_hierarchy.rs b/crates/ide/src/call_hierarchy.rs
index 5a8cda8fb3d..48bcd37b62c 100644
--- a/crates/ide/src/call_hierarchy.rs
+++ b/crates/ide/src/call_hierarchy.rs
@@ -57,7 +57,8 @@ pub(crate) fn incoming_calls(
         .flat_map(|func| func.usages(sema).all());
 
     for (_, references) in references {
-        let references = references.into_iter().map(|FileReference { name, .. }| name);
+        let references =
+            references.iter().filter_map(|FileReference { name, .. }| name.as_name_ref());
         for name in references {
             // This target is the containing function
             let nav = sema.ancestors_with_macros(name.syntax().clone()).find_map(|node| {
@@ -457,4 +458,28 @@ fn caller$0() {
             expect![[]],
         );
     }
+
+    #[test]
+    fn test_trait_method_call_hierarchy() {
+        check_hierarchy(
+            r#"
+trait T1 {
+    fn call$0ee();
+}
+
+struct S1;
+
+impl T1 for S1 {
+    fn callee() {}
+}
+
+fn caller() {
+    S1::callee();
+}
+"#,
+            expect![["callee Function FileId(0) 15..27 18..24"]],
+            expect![["caller Function FileId(0) 82..115 85..91 : [104..110]"]],
+            expect![[]],
+        );
+    }
 }