aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/resolver.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/resolver.rs')
-rw-r--r--crates/ra_hir_def/src/resolver.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/crates/ra_hir_def/src/resolver.rs b/crates/ra_hir_def/src/resolver.rs
index 5365b80e2..9dd4fa555 100644
--- a/crates/ra_hir_def/src/resolver.rs
+++ b/crates/ra_hir_def/src/resolver.rs
@@ -15,7 +15,7 @@ use crate::{
15 db::DefDatabase, 15 db::DefDatabase,
16 expr::{ExprId, PatId}, 16 expr::{ExprId, PatId},
17 generics::GenericParams, 17 generics::GenericParams,
18 item_scope::BuiltinShadowMode, 18 item_scope::{BuiltinShadowMode, BUILTIN_SCOPE},
19 nameres::CrateDefMap, 19 nameres::CrateDefMap,
20 path::{ModPath, PathKind}, 20 path::{ModPath, PathKind},
21 per_ns::PerNs, 21 per_ns::PerNs,
@@ -193,7 +193,7 @@ impl Resolver {
193 return Some((res, idx)); 193 return Some((res, idx));
194 } 194 }
195 Scope::LocalItemsScope(body) => { 195 Scope::LocalItemsScope(body) => {
196 let def = body.item_scope.get(first_name, BuiltinShadowMode::Other); 196 let def = body.item_scope.get(first_name);
197 if let Some(res) = to_type_ns(def) { 197 if let Some(res) = to_type_ns(def) {
198 return Some((res, None)); 198 return Some((res, None));
199 } 199 }
@@ -335,8 +335,10 @@ impl Resolver {
335 }; 335 };
336 } 336 }
337 Scope::LocalItemsScope(body) => { 337 Scope::LocalItemsScope(body) => {
338 let def = body.item_scope.get(first_name, BuiltinShadowMode::Other); 338 // we don't bother looking in the builtin scope here because there are no builtin values
339 if let Some(res) = to_value_ns(def) { 339 let def = to_value_ns(body.item_scope.get(first_name));
340
341 if let Some(res) = def {
340 return Some(ResolveValueResult::ValueNs(res)); 342 return Some(ResolveValueResult::ValueNs(res));
341 } 343 }
342 } 344 }
@@ -476,6 +478,9 @@ impl Scope {
476 m.crate_def_map.extern_prelude.iter().for_each(|(name, &def)| { 478 m.crate_def_map.extern_prelude.iter().for_each(|(name, &def)| {
477 f(name.clone(), ScopeDef::PerNs(PerNs::types(def, Visibility::Public))); 479 f(name.clone(), ScopeDef::PerNs(PerNs::types(def, Visibility::Public)));
478 }); 480 });
481 BUILTIN_SCOPE.iter().for_each(|(name, &def)| {
482 f(name.clone(), ScopeDef::PerNs(def));
483 });
479 if let Some(prelude) = m.crate_def_map.prelude { 484 if let Some(prelude) = m.crate_def_map.prelude {
480 let prelude_def_map = db.crate_def_map(prelude.krate); 485 let prelude_def_map = db.crate_def_map(prelude.krate);
481 prelude_def_map[prelude.local_id].scope.entries().for_each(|(name, def)| { 486 prelude_def_map[prelude.local_id].scope.entries().for_each(|(name, def)| {