@@ -1972,9 +1972,9 @@ impl Type {
19721972 pub fn type_parameters ( & self ) -> impl Iterator < Item = Type > + ' _ {
19731973 self . ty
19741974 . strip_references ( )
1975- . substs ( )
1975+ . as_adt ( )
19761976 . into_iter ( )
1977- . flat_map ( |substs| substs. iter ( & Interner ) )
1977+ . flat_map ( |( _ , substs) | substs. iter ( & Interner ) )
19781978 . filter_map ( |arg| arg. ty ( & Interner ) . cloned ( ) )
19791979 . map ( move |ty| self . derived ( ty) )
19801980 }
@@ -2115,18 +2115,22 @@ impl Type {
21152115 fn walk_type ( db : & dyn HirDatabase , type_ : & Type , cb : & mut impl FnMut ( Type ) ) {
21162116 let ty = type_. ty . strip_references ( ) ;
21172117 match ty. kind ( & Interner ) {
2118- TyKind :: Adt ( .. ) => {
2118+ TyKind :: Adt ( _ , substs ) => {
21192119 cb ( type_. derived ( ty. clone ( ) ) ) ;
2120+ walk_substs ( db, type_, & substs, cb) ;
21202121 }
2121- TyKind :: AssociatedType ( .. ) => {
2122+ TyKind :: AssociatedType ( _ , substs ) => {
21222123 if let Some ( _) = ty. associated_type_parent_trait ( db) {
21232124 cb ( type_. derived ( ty. clone ( ) ) ) ;
21242125 }
2126+ walk_substs ( db, type_, & substs, cb) ;
21252127 }
2126- TyKind :: OpaqueType ( .. ) => {
2128+ TyKind :: OpaqueType ( _ , subst ) => {
21272129 if let Some ( bounds) = ty. impl_trait_bounds ( db) {
21282130 walk_bounds ( db, & type_. derived ( ty. clone ( ) ) , & bounds, cb) ;
21292131 }
2132+
2133+ walk_substs ( db, type_, subst, cb) ;
21302134 }
21312135 TyKind :: Alias ( AliasTy :: Opaque ( opaque_ty) ) => {
21322136 if let Some ( bounds) = ty. impl_trait_bounds ( db) {
@@ -2156,11 +2160,17 @@ impl Type {
21562160 walk_type ( db, & type_. derived ( ty. clone ( ) ) , cb) ;
21572161 }
21582162
2163+ TyKind :: FnDef ( _, substs)
2164+ | TyKind :: Tuple ( _, substs)
2165+ | TyKind :: Closure ( .., substs) => {
2166+ walk_substs ( db, type_, & substs, cb) ;
2167+ }
2168+ TyKind :: Function ( hir_ty:: FnPointer { substitution, .. } ) => {
2169+ walk_substs ( db, type_, & substitution. 0 , cb) ;
2170+ }
2171+
21592172 _ => { }
21602173 }
2161- if let Some ( substs) = ty. substs ( ) {
2162- walk_substs ( db, type_, & substs, cb) ;
2163- }
21642174 }
21652175
21662176 walk_type ( db, self , & mut cb) ;
0 commit comments