diff --git a/crates/ide-completion/src/completions/pattern.rs b/crates/ide-completion/src/completions/pattern.rs index 71d2d9d434b..58d5bf114cc 100644 --- a/crates/ide-completion/src/completions/pattern.rs +++ b/crates/ide-completion/src/completions/pattern.rs @@ -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, }; diff --git a/crates/ide-completion/src/tests/pattern.rs b/crates/ide-completion/src/tests/pattern.rs index 85c4dbd6625..db8bef66405 100644 --- a/crates/ide-completion/src/tests/pattern.rs +++ b/crates/ide-completion/src/tests/pattern.rs @@ -714,3 +714,30 @@ fn foo(foo: u8, b$0) "#]], ); } + +#[test] +fn through_alias() { + check_empty( + r#" +enum Enum { + Unit, + Tuple(T), +} + +type EnumAlias = Enum; + +fn f(x: EnumAlias) { + match x { + EnumAlias::$0 => (), + _ => (), + } + +} + +"#, + expect![[r#" + bn Tuple(…) Tuple($1)$0 + bn Unit Unit$0 + "#]], + ); +}