aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/nameres
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/nameres')
-rw-r--r--crates/ra_hir_def/src/nameres/collector.rs2
-rw-r--r--crates/ra_hir_def/src/nameres/tests/mod_resolution.rs45
2 files changed, 46 insertions, 1 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs
index 35b852ee2..7499dff31 100644
--- a/crates/ra_hir_def/src/nameres/collector.rs
+++ b/crates/ra_hir_def/src/nameres/collector.rs
@@ -328,7 +328,7 @@ where
328 ); 328 );
329 329
330 let def = res.resolved_def; 330 let def = res.resolved_def;
331 if res.reached_fixedpoint == ReachedFixedPoint::No { 331 if res.reached_fixedpoint == ReachedFixedPoint::No || def.is_none() {
332 return PartialResolvedImport::Unresolved; 332 return PartialResolvedImport::Unresolved;
333 } 333 }
334 334
diff --git a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs
index e800cc68e..22103ab29 100644
--- a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs
+++ b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs
@@ -53,6 +53,51 @@ fn nested_module_resolution() {
53} 53}
54 54
55#[test] 55#[test]
56fn nested_module_resolution_2() {
57 let map = def_map(
58 "
59 //- /lib.rs
60 mod prelude;
61 mod iter;
62
63 //- /prelude.rs
64 pub use crate::iter::Iterator;
65
66 //- /iter.rs
67 pub use self::traits::Iterator;
68 mod traits;
69
70 //- /iter/traits.rs
71 pub use self::iterator::Iterator;
72 mod iterator;
73
74 //- /iter/traits/iterator.rs
75 pub trait Iterator;
76 ",
77 );
78
79 assert_snapshot!(map, @r###"
80 crate
81 iter: t
82 prelude: t
83
84 crate::iter
85 Iterator: t
86 traits: t
87
88 crate::iter::traits
89 Iterator: t
90 iterator: t
91
92 crate::iter::traits::iterator
93 Iterator: t
94
95 crate::prelude
96 Iterator: t
97 "###);
98}
99
100#[test]
56fn module_resolution_works_for_non_standard_filenames() { 101fn module_resolution_works_for_non_standard_filenames() {
57 let map = def_map( 102 let map = def_map(
58 " 103 "