Complete variants and assoc items in path pattern through type aliases
This commit is contained in:
parent
2b61be2975
commit
ad17ba12d1
@ -145,6 +145,7 @@ pub(crate) fn complete_pattern_path(
|
||||
u.ty(ctx.db)
|
||||
}
|
||||
hir::PathResolution::Def(hir::ModuleDef::BuiltinType(ty)) => ty.ty(ctx.db),
|
||||
hir::PathResolution::Def(hir::ModuleDef::TypeAlias(ty)) => ty.ty(ctx.db),
|
||||
_ => return,
|
||||
};
|
||||
|
||||
|
@ -714,3 +714,30 @@ fn foo(foo: u8, b$0)
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn through_alias() {
|
||||
check_empty(
|
||||
r#"
|
||||
enum Enum<T> {
|
||||
Unit,
|
||||
Tuple(T),
|
||||
}
|
||||
|
||||
type EnumAlias<T> = Enum<T>;
|
||||
|
||||
fn f(x: EnumAlias<u8>) {
|
||||
match x {
|
||||
EnumAlias::$0 => (),
|
||||
_ => (),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
"#,
|
||||
expect![[r#"
|
||||
bn Tuple(…) Tuple($1)$0
|
||||
bn Unit Unit$0
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user