aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r--crates/ra_hir/src/ty.rs22
1 files changed, 15 insertions, 7 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index f86b749ec..429292cfc 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -15,7 +15,11 @@ use ra_syntax::{
15 SyntaxNodeRef 15 SyntaxNodeRef
16}; 16};
17 17
18use crate::{Def, DefId, FnScopes, Module, Function, Path, db::HirDatabase}; 18use crate::{
19 Def, DefId, FnScopes, Module, Function,
20 Path, db::HirDatabase,
21 module::nameres::Namespace
22};
19 23
20#[derive(Clone, PartialEq, Eq, Hash, Debug)] 24#[derive(Clone, PartialEq, Eq, Hash, Debug)]
21pub enum Ty { 25pub enum Ty {
@@ -149,11 +153,12 @@ impl Ty {
149 } 153 }
150 154
151 // Resolve in module (in type namespace) 155 // Resolve in module (in type namespace)
152 let resolved = if let Some(r) = module.resolve_path(db, path)? { 156 let resolved =
153 r 157 if let Some(r) = module.resolve_path(db, path)?.take(Namespace::Types) {
154 } else { 158 r
155 return Ok(Ty::Unknown); 159 } else {
156 }; 160 return Ok(Ty::Unknown);
161 };
157 let ty = db.type_for_def(resolved)?; 162 let ty = db.type_for_def(resolved)?;
158 ty 163 ty
159 } 164 }
@@ -325,7 +330,10 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
325 }; 330 };
326 331
327 // resolve in module 332 // resolve in module
328 let resolved = ctry!(self.module.resolve_path(self.db, path)?); 333 let resolved = ctry!(self
334 .module
335 .resolve_path(self.db, path)?
336 .take(Namespace::Values));
329 let ty = self.db.type_for_def(resolved)?; 337 let ty = self.db.type_for_def(resolved)?;
330 // TODO we will need to add type variables for type parameters etc. here 338 // TODO we will need to add type variables for type parameters etc. here
331 Ok(Some(ty)) 339 Ok(Some(ty))