mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 14:10:03 +03:00
Fix the wrong path resolution
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
This commit is contained in:
@@ -143,10 +143,15 @@ fn pattern_path_completion(
|
||||
.into_iter()
|
||||
.for_each(|variant| acc.add_enum_variant(ctx, variant, None));
|
||||
}
|
||||
res @ (hir::PathResolution::TypeParam(_) | hir::PathResolution::SelfType(_)) => {
|
||||
res @ (hir::PathResolution::TypeParam(_)
|
||||
| hir::PathResolution::SelfType(_)
|
||||
| hir::PathResolution::Def(hir::ModuleDef::Adt(hir::Adt::Struct(_)))) => {
|
||||
let ty = match res {
|
||||
hir::PathResolution::TypeParam(param) => param.ty(ctx.db),
|
||||
hir::PathResolution::SelfType(impl_def) => impl_def.self_ty(ctx.db),
|
||||
hir::PathResolution::Def(hir::ModuleDef::Adt(hir::Adt::Struct(s))) => {
|
||||
s.ty(ctx.db)
|
||||
}
|
||||
_ => return,
|
||||
};
|
||||
|
||||
|
||||
@@ -463,6 +463,8 @@ fn f(t: Ty) {
|
||||
}
|
||||
}
|
||||
"#,
|
||||
expect![[""]],
|
||||
expect![[r#"
|
||||
ct ABC const ABC: Self
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user