Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/source_analyzer.rs')
-rw-r--r--crates/hir/src/source_analyzer.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs
index ef32a5891c..1295d05007 100644
--- a/crates/hir/src/source_analyzer.rs
+++ b/crates/hir/src/source_analyzer.rs
@@ -34,7 +34,7 @@ use syntax::{
use crate::{
db::HirDatabase, semantics::PathResolution, Adt, BuiltinAttr, BuiltinType, Const, Field,
Function, Local, MacroDef, ModuleDef, Static, Struct, ToolModule, Trait, Type, TypeAlias,
- TypeParam, Variant,
+ TypeOrConstParam, Variant,
};
use base_db::CrateId;
@@ -609,7 +609,10 @@ fn resolve_hir_path_(
let res = match ty {
TypeNs::SelfType(it) => PathResolution::SelfType(it.into()),
- TypeNs::GenericParam(id) => PathResolution::TypeParam(TypeParam { id }),
+ TypeNs::GenericParam(id) => match (TypeOrConstParam { id }).split(db) {
+ either::Either::Left(x) => PathResolution::ConstParam(x),
+ either::Either::Right(x) => PathResolution::TypeParam(x),
+ },
TypeNs::AdtSelfType(it) | TypeNs::AdtId(it) => {
PathResolution::Def(Adt::from(it).into())
}
@@ -650,7 +653,7 @@ fn resolve_hir_path_(
ValueNs::StructId(it) => PathResolution::Def(Struct::from(it).into()),
ValueNs::EnumVariantId(it) => PathResolution::Def(Variant::from(it).into()),
ValueNs::ImplSelf(impl_id) => PathResolution::SelfType(impl_id.into()),
- ValueNs::GenericParam(it) => PathResolution::ConstParam(it.into()),
+ ValueNs::GenericParam(id) => PathResolution::ConstParam(id.into()),
};
Some(res)
})
@@ -703,7 +706,10 @@ fn resolve_hir_path_qualifier(
resolver.resolve_path_in_type_ns_fully(db.upcast(), path.mod_path()).map(|ty| match ty {
TypeNs::SelfType(it) => PathResolution::SelfType(it.into()),
- TypeNs::GenericParam(id) => PathResolution::TypeParam(TypeParam { id }),
+ TypeNs::GenericParam(id) => match (TypeOrConstParam { id }).split(db) {
+ either::Either::Left(x) => PathResolution::ConstParam(x),
+ either::Either::Right(x) => PathResolution::TypeParam(x),
+ },
TypeNs::AdtSelfType(it) | TypeNs::AdtId(it) => PathResolution::Def(Adt::from(it).into()),
TypeNs::EnumVariantId(it) => PathResolution::Def(Variant::from(it).into()),
TypeNs::TypeAliasId(it) => PathResolution::Def(TypeAlias::from(it).into()),