Fix the wrong path resolution
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
This commit is contained in:
parent
a9aae250ed
commit
c6ef4e830e
2 changed files with 9 additions and 2 deletions
|
|
@ -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
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue