diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-13 09:18:47 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-13 09:18:47 +0000 |
commit | b0ed808266e346b0f9330822f874e930710df4ec (patch) | |
tree | 5fec1ee6c1af3e3763c3a694a34789e856fc9d13 /crates/ra_hir_def/src/nameres | |
parent | 56590097ed71374902f1e1c44cde487db4e3ab4f (diff) | |
parent | 7208498d54b9f3d386b58f901c911a35170057ce (diff) |
Merge #3553
3553: Completions do not show for function with same name as mod r=matklad a=JoshMcguigan
fixes #3444
I've added a test case in `crates/ra_ide/src/completion/complete_path.rs` which verifies the described behavior in #3444. Digging in, I found that [the module scope iterator](https://github.com/JoshMcguigan/rust-analyzer/blob/ba62d8bd1ce8a68b8d21aaf89ae1ea6787f18366/crates/ra_ide/src/completion/complete_path.rs#L22) only provides the module `z`, and does not provide the function `z` (although if I name the function something else then it does show up here).
I thought perhaps the name wasn't being properly resolved, but I added a test in `crates/ra_hir_def/src/nameres/tests.rs` which seems to suggest that it is? I've tried to figure out how to bridge the gap between these two tests (one passing, one failing) to see where the function `z` is being dropped, but to this point I haven't been able to track it down.
Any pointers on where I might look for this?
Co-authored-by: Josh Mcguigan <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/nameres')
-rw-r--r-- | crates/ra_hir_def/src/nameres/tests.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/nameres/tests.rs b/crates/ra_hir_def/src/nameres/tests.rs index dda5ed699..3f33a75b9 100644 --- a/crates/ra_hir_def/src/nameres/tests.rs +++ b/crates/ra_hir_def/src/nameres/tests.rs | |||
@@ -102,6 +102,28 @@ fn crate_def_map_super_super() { | |||
102 | } | 102 | } |
103 | 103 | ||
104 | #[test] | 104 | #[test] |
105 | fn crate_def_map_fn_mod_same_name() { | ||
106 | let map = def_map( | ||
107 | " | ||
108 | //- /lib.rs | ||
109 | mod m { | ||
110 | pub mod z {} | ||
111 | pub fn z() {} | ||
112 | } | ||
113 | ", | ||
114 | ); | ||
115 | assert_snapshot!(map, @r###" | ||
116 | ⋮crate | ||
117 | ⋮m: t | ||
118 | ⋮ | ||
119 | ⋮crate::m | ||
120 | ⋮z: t v | ||
121 | ⋮ | ||
122 | ⋮crate::m::z | ||
123 | "###) | ||
124 | } | ||
125 | |||
126 | #[test] | ||
105 | fn bogus_paths() { | 127 | fn bogus_paths() { |
106 | covers!(bogus_paths); | 128 | covers!(bogus_paths); |
107 | let map = def_map( | 129 | let map = def_map( |