@@ -166,9 +166,9 @@ predicate traitTypeParameterOccurrence(
166166}
167167
168168pragma [ nomagic]
169- private predicate functionResolutionDependsOnArgumentCand (
170- ImplItemNode impl , Function f , string functionName , TypeParameter traitTp , FunctionPosition pos ,
171- TypePath path
169+ predicate functionResolutionDependsOnArgumentCand (
170+ ImplItemNode impl , Function f , string functionName , TypeParamTypeParameter traitTp ,
171+ FunctionPosition pos , TypePath path
172172) {
173173 /*
174174 * As seen in the example below, when an implementation has a sibling for a
@@ -199,12 +199,14 @@ private predicate functionResolutionDependsOnArgumentCand(
199199 )
200200}
201201
202- private predicate functionResolutionDependsOnPositionalArgumentCand (
203- ImplItemNode impl , Function f , string functionName , TypeParameter traitTp
202+ pragma [ nomagic]
203+ predicate functionResolutionDependsOnPositionalArgumentCand (
204+ ImplItemNode impl , Function f , string functionName , TypeParamTypeParameter traitTp , int pos ,
205+ TypePath path
204206) {
205- exists ( FunctionPosition pos |
206- functionResolutionDependsOnArgumentCand ( impl , f , functionName , traitTp , pos , _ ) and
207- pos . isPosition ( )
207+ exists ( FunctionPosition pos0 |
208+ functionResolutionDependsOnArgumentCand ( impl , f , functionName , traitTp , pos0 , path ) and
209+ pos = pos0 . asPosition ( )
208210 )
209211}
210212
@@ -223,7 +225,7 @@ private Type getAssocFunctionNonTypeParameterTypeAt(
223225 */
224226pragma [ nomagic]
225227private predicate hasEquivalentPositionalSibling (
226- ImplItemNode impl , ImplItemNode sibling , Function f , TypeParameter traitTp
228+ ImplItemNode impl , ImplItemNode sibling , Function f , TypeParamTypeParameter traitTp
227229) {
228230 exists ( string functionName , FunctionPosition pos , TypePath path |
229231 functionResolutionDependsOnArgumentCand ( impl , f , functionName , traitTp , pos , path ) and
@@ -255,7 +257,7 @@ private predicate hasEquivalentPositionalSibling(
255257 *
256258 * `traitTp` is a type parameter of the trait being implemented by `impl`, and
257259 * we need to check that the type of `f` corresponding to `traitTp` is satisfied
258- * at any one of the positions `pos` in which that type occurs in `f`.
260+ * at any one of the positions `pos` in which that type occurs at `path` in `f`.
259261 *
260262 * Type parameters that only occur in return positions are only included when
261263 * all other type parameters that occur in a positional position are insufficient
@@ -283,19 +285,20 @@ private predicate hasEquivalentPositionalSibling(
283285 */
284286pragma [ nomagic]
285287predicate functionResolutionDependsOnArgument (
286- ImplItemNode impl , Function f , TypeParameter traitTp , FunctionPosition pos
288+ ImplItemNode impl , Function f , TypeParamTypeParameter traitTp , FunctionPosition pos , TypePath path
287289) {
288290 exists ( string functionName |
289- functionResolutionDependsOnArgumentCand ( impl , f , functionName , traitTp , pos , _ )
291+ functionResolutionDependsOnArgumentCand ( impl , f , functionName , traitTp , pos , path )
290292 |
291- if functionResolutionDependsOnPositionalArgumentCand ( impl , f , functionName , traitTp )
293+ if functionResolutionDependsOnPositionalArgumentCand ( impl , f , functionName , traitTp , _ , _ )
292294 then any ( )
293295 else
294296 // `traitTp` only occurs in return position; check that it is indeed needed for disambiguation
295297 exists ( ImplItemNode sibling |
296298 implSiblings ( _, impl , sibling ) and
297- forall ( TypeParameter otherTraitTp |
298- functionResolutionDependsOnPositionalArgumentCand ( impl , f , functionName , otherTraitTp )
299+ forall ( TypeParamTypeParameter otherTraitTp |
300+ functionResolutionDependsOnPositionalArgumentCand ( impl , f , functionName , otherTraitTp , _,
301+ _)
299302 |
300303 hasEquivalentPositionalSibling ( impl , sibling , f , otherTraitTp )
301304 )
0 commit comments