@@ -46,11 +46,32 @@ pub(crate) fn complete_expr_path(
4646 } ;
4747
4848 match qualified {
49- Qualified :: Infer => ctx
49+ Qualified :: TypeAnchor { ty : None , trait_ : None } => ctx
5050 . traits_in_scope ( )
5151 . iter ( )
5252 . flat_map ( |& it| hir:: Trait :: from ( it) . items ( ctx. sema . db ) )
5353 . for_each ( |item| add_assoc_item ( acc, item) ) ,
54+ Qualified :: TypeAnchor { trait_ : Some ( trait_) , .. } => {
55+ trait_. items ( ctx. sema . db ) . into_iter ( ) . for_each ( |item| add_assoc_item ( acc, item) )
56+ }
57+ Qualified :: TypeAnchor { ty : Some ( ty) , trait_ : None } => {
58+ if let Some ( hir:: Adt :: Enum ( e) ) = ty. as_adt ( ) {
59+ cov_mark:: hit!( completes_variant_through_alias) ;
60+ acc. add_enum_variants ( ctx, path_ctx, e) ;
61+ }
62+
63+ ctx. iterate_path_candidates ( & ty, |item| {
64+ add_assoc_item ( acc, item) ;
65+ } ) ;
66+
67+ // Iterate assoc types separately
68+ ty. iterate_assoc_items ( ctx. db , ctx. krate , |item| {
69+ if let hir:: AssocItem :: TypeAlias ( ty) = item {
70+ acc. add_type_alias ( ctx, ty)
71+ }
72+ None :: < ( ) >
73+ } ) ;
74+ }
5475 Qualified :: With { resolution : None , .. } => { }
5576 Qualified :: With { resolution : Some ( resolution) , .. } => {
5677 // Add associated types on type parameters and `Self`.
0 commit comments