aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/semantics.rs1
-rw-r--r--crates/ra_hir/src/semantics/source_to_def.rs7
-rw-r--r--crates/ra_ide/src/goto_definition.rs10
3 files changed, 18 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 }
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs
index 8fc33d031..f575d738f 100644
--- a/crates/ra_ide/src/goto_definition.rs
+++ b/crates/ra_ide/src/goto_definition.rs
@@ -856,4 +856,14 @@ impl Foo {
856"#, 856"#,
857 ); 857 );
858 } 858 }
859
860 #[test]
861 fn goto_def_for_type_alias_generic_parameter() {
862 check(
863 r#"
864type Alias<T> = T<|>;
865 //^
866"#,
867 )
868 }
859} 869}