aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/resolver.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-07 19:26:33 +0000
committerGitHub <[email protected]>2019-12-07 19:26:33 +0000
commit971df306ada43f6150e12a143873f680e104a866 (patch)
tree913c24e889f3db8044b4b9f11bc3969e7eb02e34 /crates/ra_hir_def/src/resolver.rs
parenta3eb8787452a04400784ba8fed38303232595695 (diff)
parent88c5b1282a5770097c6c768b24bedfc3a6944e08 (diff)
Merge #2494
2494: Get the right analyzer for impls r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/resolver.rs')
-rw-r--r--crates/ra_hir_def/src/resolver.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/ra_hir_def/src/resolver.rs b/crates/ra_hir_def/src/resolver.rs
index e00bd03d5..4c859e497 100644
--- a/crates/ra_hir_def/src/resolver.rs
+++ b/crates/ra_hir_def/src/resolver.rs
@@ -18,8 +18,8 @@ use crate::{
18 path::{Path, PathKind}, 18 path::{Path, PathKind},
19 per_ns::PerNs, 19 per_ns::PerNs,
20 AdtId, AstItemDef, ConstId, ContainerId, DefWithBodyId, EnumId, EnumVariantId, FunctionId, 20 AdtId, AstItemDef, ConstId, ContainerId, DefWithBodyId, EnumId, EnumVariantId, FunctionId,
21 GenericDefId, GenericParamId, HasModule, ImplId, LocalModuleId, Lookup, ModuleDefId, ModuleId, 21 GenericDefId, HasModule, ImplId, LocalModuleId, Lookup, ModuleDefId, ModuleId, StaticId,
22 StaticId, StructId, TraitId, TypeAliasId, 22 StructId, TraitId, TypeAliasId, TypeParamId,
23}; 23};
24 24
25#[derive(Debug, Clone, Default)] 25#[derive(Debug, Clone, Default)]
@@ -59,7 +59,7 @@ enum Scope {
59#[derive(Debug, Clone, PartialEq, Eq, Hash)] 59#[derive(Debug, Clone, PartialEq, Eq, Hash)]
60pub enum TypeNs { 60pub enum TypeNs {
61 SelfType(ImplId), 61 SelfType(ImplId),
62 GenericParam(GenericParamId), 62 GenericParam(TypeParamId),
63 AdtId(AdtId), 63 AdtId(AdtId),
64 AdtSelfType(AdtId), 64 AdtSelfType(AdtId),
65 // Yup, enum variants are added to the types ns, but any usage of variant as 65 // Yup, enum variants are added to the types ns, but any usage of variant as
@@ -157,7 +157,7 @@ impl Resolver {
157 if let Some(local_id) = params.find_by_name(first_name) { 157 if let Some(local_id) = params.find_by_name(first_name) {
158 let idx = if path.segments.len() == 1 { None } else { Some(1) }; 158 let idx = if path.segments.len() == 1 { None } else { Some(1) };
159 return Some(( 159 return Some((
160 TypeNs::GenericParam(GenericParamId { local_id, parent: *def }), 160 TypeNs::GenericParam(TypeParamId { local_id, parent: *def }),
161 idx, 161 idx,
162 )); 162 ));
163 } 163 }
@@ -252,7 +252,7 @@ impl Resolver {
252 252
253 Scope::GenericParams { params, def } if n_segments > 1 => { 253 Scope::GenericParams { params, def } if n_segments > 1 => {
254 if let Some(local_id) = params.find_by_name(first_name) { 254 if let Some(local_id) = params.find_by_name(first_name) {
255 let ty = TypeNs::GenericParam(GenericParamId { local_id, parent: *def }); 255 let ty = TypeNs::GenericParam(TypeParamId { local_id, parent: *def });
256 return Some(ResolveValueResult::Partial(ty, 1)); 256 return Some(ResolveValueResult::Partial(ty, 1));
257 } 257 }
258 } 258 }
@@ -399,7 +399,7 @@ pub enum ScopeDef {
399 PerNs(PerNs), 399 PerNs(PerNs),
400 ImplSelfType(ImplId), 400 ImplSelfType(ImplId),
401 AdtSelfType(AdtId), 401 AdtSelfType(AdtId),
402 GenericParam(GenericParamId), 402 GenericParam(TypeParamId),
403 Local(PatId), 403 Local(PatId),
404} 404}
405 405
@@ -431,10 +431,10 @@ impl Scope {
431 } 431 }
432 } 432 }
433 Scope::GenericParams { params, def } => { 433 Scope::GenericParams { params, def } => {
434 for (local_id, param) in params.params.iter() { 434 for (local_id, param) in params.types.iter() {
435 f( 435 f(
436 param.name.clone(), 436 param.name.clone(),
437 ScopeDef::GenericParam(GenericParamId { local_id, parent: *def }), 437 ScopeDef::GenericParam(TypeParamId { local_id, parent: *def }),
438 ) 438 )
439 } 439 }
440 } 440 }
@@ -481,7 +481,7 @@ impl Resolver {
481 481
482 fn push_generic_params_scope(self, db: &impl DefDatabase, def: GenericDefId) -> Resolver { 482 fn push_generic_params_scope(self, db: &impl DefDatabase, def: GenericDefId) -> Resolver {
483 let params = db.generic_params(def); 483 let params = db.generic_params(def);
484 if params.params.is_empty() { 484 if params.types.is_empty() {
485 self 485 self
486 } else { 486 } else {
487 self.push_scope(Scope::GenericParams { def, params }) 487 self.push_scope(Scope::GenericParams { def, params })