diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/libanalysis/src/module_map.rs | 6 | ||||
-rw-r--r-- | crates/libanalysis/tests/tests.rs | 13 |
2 files changed, 19 insertions, 0 deletions
diff --git a/crates/libanalysis/src/module_map.rs b/crates/libanalysis/src/module_map.rs index b65569c46..47c0018e1 100644 --- a/crates/libanalysis/src/module_map.rs +++ b/crates/libanalysis/src/module_map.rs | |||
@@ -220,6 +220,12 @@ impl Link { | |||
220 | } | 220 | } |
221 | 221 | ||
222 | fn resolve(&mut self, file_resolver: &FileResolver) { | 222 | fn resolve(&mut self, file_resolver: &FileResolver) { |
223 | if !self.ast().has_semi() { | ||
224 | self.problem = None; | ||
225 | self.points_to = Vec::new(); | ||
226 | return; | ||
227 | } | ||
228 | |||
223 | let mod_name = file_resolver.file_stem(self.owner.0); | 229 | let mod_name = file_resolver.file_stem(self.owner.0); |
224 | let is_dir_owner = | 230 | let is_dir_owner = |
225 | mod_name == "mod" || mod_name == "lib" || mod_name == "main"; | 231 | mod_name == "mod" || mod_name == "lib" || mod_name == "main"; |
diff --git a/crates/libanalysis/tests/tests.rs b/crates/libanalysis/tests/tests.rs index e378ab986..e05aa8895 100644 --- a/crates/libanalysis/tests/tests.rs +++ b/crates/libanalysis/tests/tests.rs | |||
@@ -79,6 +79,19 @@ fn test_unresolved_module_diagnostic() { | |||
79 | } | 79 | } |
80 | 80 | ||
81 | #[test] | 81 | #[test] |
82 | fn test_unresolved_module_diagnostic_no_diag_for_inline_mode() { | ||
83 | let mut world = WorldState::new(); | ||
84 | world.change_file(FileId(1), Some("mod foo {}".to_string())); | ||
85 | |||
86 | let snap = world.snapshot(FileMap(&[(1, "/lib.rs")])); | ||
87 | let diagnostics = snap.diagnostics(FileId(1)).unwrap(); | ||
88 | assert_eq_dbg( | ||
89 | r#"[]"#, | ||
90 | &diagnostics, | ||
91 | ); | ||
92 | } | ||
93 | |||
94 | #[test] | ||
82 | fn test_resolve_parent_module() { | 95 | fn test_resolve_parent_module() { |
83 | let mut world = WorldState::new(); | 96 | let mut world = WorldState::new(); |
84 | world.change_file(FileId(1), Some("mod foo;".to_string())); | 97 | world.change_file(FileId(1), Some("mod foo;".to_string())); |