File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
rust/ql/lib/codeql/rust/internal/typeinference Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -274,20 +274,21 @@ private class FunctionDeclaration extends Function {
274274 this = i .asSome ( ) .getAnAssocItem ( )
275275 }
276276
277+ TypeParam getTypeParam ( ImplOrTraitItemNodeOption i ) {
278+ i = parent and
279+ result = [ this .getGenericParamList ( ) .getATypeParam ( ) , i .asSome ( ) .getTypeParam ( _) ]
280+ }
281+
277282 TypeParameter getTypeParameter ( ImplOrTraitItemNodeOption i , TypeParameterPosition ppos ) {
283+ typeParamMatchPosition ( this .getTypeParam ( i ) , result , ppos )
284+ or
285+ // For every `TypeParam` of this function, any associated types accessed on
286+ // the type parameter are also type parameters.
287+ ppos .isImplicit ( ) and
288+ result .( TypeParamAssociatedTypeTypeParameter ) .getTypeParam ( ) = this .getTypeParam ( i )
289+ or
278290 i = parent and
279291 (
280- exists ( TypeParam tp |
281- tp = [ this .getGenericParamList ( ) .getATypeParam ( ) , i .asSome ( ) .getTypeParam ( _) ]
282- |
283- typeParamMatchPosition ( tp , result , ppos )
284- or
285- // If `tp` is a type parameter for this function, then any associated
286- // types accessed on `tp` are also type parameters.
287- ppos .isImplicit ( ) and
288- result .( TypeParamAssociatedTypeTypeParameter ) .getTypeParam ( ) = tp
289- )
290- or
291292 ppos .isImplicit ( ) and result = TSelfTypeParameter ( i .asSome ( ) )
292293 or
293294 ppos .isImplicit ( ) and result .( AssociatedTypeTypeParameter ) .getTrait ( ) = i .asSome ( )
You can’t perform that action at this time.
0 commit comments