@@ -1411,20 +1411,35 @@ private module MethodCallResolution {
14111411 else any ( )
14121412 }
14131413
1414+ pragma [ nomagic]
1415+ private Type inferPositionalArgumentType ( FunctionPosition pos , TypePath path ) {
1416+ pos .isPositional ( ) and
1417+ result = inferType ( mc_ .getArgument ( pos .asArgumentPosition ( ) ) , path )
1418+ }
1419+
1420+ pragma [ nomagic]
1421+ private Function resolveAmbigousCallTargetCand ( FunctionPosition pos , TypePath path , Type type ) {
1422+ exists ( ImplOrTraitItemNode i , string name |
1423+ result = this .resolveCallTargetCand ( i , name ) and
1424+ FunctionOverloading:: functionResolutionDependsOnArgument ( i , name , result , pos , path , type )
1425+ )
1426+ }
1427+
14141428 /** Gets a method that matches this method call. */
14151429 pragma [ nomagic]
14161430 Function resolveCallTarget ( ) {
1417- exists ( ImplOrTraitItemNode i , string name | result = this .resolveCallTargetCand ( i , name ) |
1418- not FunctionOverloading:: functionResolutionDependsOnArgument ( i , name , _,
1419- any ( FunctionPosition pos | pos .isPositional ( ) ) , _, _)
1420- or
1421- exists ( FunctionPosition pos , TypePath path , Type type |
1422- FunctionOverloading:: functionResolutionDependsOnArgument ( i , name , result , pos ,
1423- pragma [ only_bind_into ] ( path ) , type ) and
1424- pos .isPositional ( ) and
1425- inferType ( mc_ .getArgument ( pos .asArgumentPosition ( ) ) , pragma [ only_bind_into ] ( path ) ) = type
1431+ exists ( ImplOrTraitItemNode i , string name |
1432+ result = this .resolveCallTargetCand ( i , name ) and
1433+ not exists ( FunctionPosition pos |
1434+ FunctionOverloading:: functionResolutionDependsOnArgument ( i , name , _, pos , _, _) and
1435+ pos .isPositional ( )
14261436 )
14271437 )
1438+ or
1439+ exists ( FunctionPosition pos , TypePath path , Type type |
1440+ result = this .resolveAmbigousCallTargetCand ( pos , path , type ) and
1441+ type = this .inferPositionalArgumentType ( pos , path )
1442+ )
14281443 }
14291444
14301445 string toString ( ) { result = mc_ .toString ( ) + " [" + derefChainBorrow + "]" }
0 commit comments