aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-11 11:45:30 +0100
committerAleksey Kladov <[email protected]>2020-07-11 11:45:30 +0100
commit8c4919c9fdfb2333fd798cd7d531f4264c939322 (patch)
tree3bce4b34534727b833d6685251aa83373acf5491 /crates/ra_hir/src
parent3fc4916b53894c63320e31855e3c62b974dfcc95 (diff)
Fix goto definition for type alias type parameters
closes https://github.com/rust-analyzer/rust-analyzer/issues/5042
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/semantics.rs1
-rw-r--r--crates/ra_hir/src/semantics/source_to_def.rs7
2 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index 97125b32a..155b666d7 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -485,6 +485,7 @@ impl<'db> SemanticsImpl<'db> {
485 ChildContainer::ModuleId(it) => it.resolver(self.db.upcast()), 485 ChildContainer::ModuleId(it) => it.resolver(self.db.upcast()),
486 ChildContainer::EnumId(it) => it.resolver(self.db.upcast()), 486 ChildContainer::EnumId(it) => it.resolver(self.db.upcast()),
487 ChildContainer::VariantId(it) => it.resolver(self.db.upcast()), 487 ChildContainer::VariantId(it) => it.resolver(self.db.upcast()),
488 ChildContainer::TypeAliasId(it) => it.resolver(self.db.upcast()),
488 ChildContainer::GenericDefId(it) => it.resolver(self.db.upcast()), 489 ChildContainer::GenericDefId(it) => it.resolver(self.db.upcast()),
489 }; 490 };
490 SourceAnalyzer::new_for_resolver(resolver, src) 491 SourceAnalyzer::new_for_resolver(resolver, src)
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs
index 8af64fdc1..0e1d92fb3 100644
--- a/crates/ra_hir/src/semantics/source_to_def.rs
+++ b/crates/ra_hir/src/semantics/source_to_def.rs
@@ -194,6 +194,10 @@ impl SourceToDefCtx<'_, '_> {
194 let def = self.const_to_def(container.with_value(it))?; 194 let def = self.const_to_def(container.with_value(it))?;
195 DefWithBodyId::from(def).into() 195 DefWithBodyId::from(def).into()
196 }, 196 },
197 ast::TypeAliasDef(it) => {
198 let def = self.type_alias_to_def(container.with_value(it))?;
199 def.into()
200 },
197 _ => continue, 201 _ => continue,
198 } 202 }
199 }; 203 };
@@ -246,6 +250,7 @@ pub(crate) enum ChildContainer {
246 ImplId(ImplId), 250 ImplId(ImplId),
247 EnumId(EnumId), 251 EnumId(EnumId),
248 VariantId(VariantId), 252 VariantId(VariantId),
253 TypeAliasId(TypeAliasId),
249 /// XXX: this might be the same def as, for example an `EnumId`. However, 254 /// XXX: this might be the same def as, for example an `EnumId`. However,
250 /// here the children generic parameters, and not, eg enum variants. 255 /// here the children generic parameters, and not, eg enum variants.
251 GenericDefId(GenericDefId), 256 GenericDefId(GenericDefId),
@@ -258,6 +263,7 @@ impl_froms! {
258 ImplId, 263 ImplId,
259 EnumId, 264 EnumId,
260 VariantId, 265 VariantId,
266 TypeAliasId,
261 GenericDefId 267 GenericDefId
262} 268}
263 269
@@ -271,6 +277,7 @@ impl ChildContainer {
271 ChildContainer::ImplId(it) => it.child_by_source(db), 277 ChildContainer::ImplId(it) => it.child_by_source(db),
272 ChildContainer::EnumId(it) => it.child_by_source(db), 278 ChildContainer::EnumId(it) => it.child_by_source(db),
273 ChildContainer::VariantId(it) => it.child_by_source(db), 279 ChildContainer::VariantId(it) => it.child_by_source(db),
280 ChildContainer::TypeAliasId(_) => DynMap::default(),
274 ChildContainer::GenericDefId(it) => it.child_by_source(db), 281 ChildContainer::GenericDefId(it) => it.child_by_source(db),
275 } 282 }
276 } 283 }