@@ -46,11 +46,32 @@ pub(crate) fn complete_expr_path(
46
46
} ;
47
47
48
48
match qualified {
49
- Qualified :: Infer => ctx
49
+ Qualified :: TypeAnchor { ty : None , trait_ : None } => ctx
50
50
. traits_in_scope ( )
51
51
. iter ( )
52
52
. flat_map ( |& it| hir:: Trait :: from ( it) . items ( ctx. sema . db ) )
53
53
. 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
+ }
54
75
Qualified :: With { resolution : None , .. } => { }
55
76
Qualified :: With { resolution : Some ( resolution) , .. } => {
56
77
// Add associated types on type parameters and `Self`.
0 commit comments