Skip to content

Commit b917d70

Browse files
authored
Merge pull request #22003 from Amit5601/fix/hidden-enum-clean
fix: complete variants of hidden enums through public aliases
2 parents 2cce657 + 9704b3f commit b917d70

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

crates/ide-completion/src/completions.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,6 @@ impl Completions {
276276
path_ctx: &PathCompletionCtx<'_>,
277277
e: hir::Enum,
278278
) {
279-
if !ctx.check_stability_and_hidden(e) {
280-
return;
281-
}
282279
e.variants(ctx.db)
283280
.into_iter()
284281
.for_each(|variant| self.add_enum_variant(ctx, path_ctx, variant, None));

crates/ide-completion/src/tests/item.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,3 +380,23 @@ foo!(f$0);
380380
"#]],
381381
);
382382
}
383+
384+
#[test]
385+
fn completes_variant_through_hidden_enum_alias() {
386+
check(
387+
r#"
388+
//- /lib.rs crate:dep
389+
#[doc(hidden)]
390+
pub enum Foo { Variant }
391+
pub type Bar = Foo;
392+
393+
//- /main.rs crate:main deps:dep
394+
fn main() {
395+
let x = dep::Bar::V$0;
396+
}
397+
"#,
398+
expect![[r#"
399+
ev Variant Variant
400+
"#]],
401+
);
402+
}

0 commit comments

Comments
 (0)