@@ -1411,20 +1411,35 @@ private module MethodCallResolution {
1411
1411
else any ( )
1412
1412
}
1413
1413
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
+
1414
1428
/** Gets a method that matches this method call. */
1415
1429
pragma [ nomagic]
1416
1430
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 ( )
1426
1436
)
1427
1437
)
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
+ )
1428
1443
}
1429
1444
1430
1445
string toString ( ) { result = mc_ .toString ( ) + " [" + derefChainBorrow + "]" }
0 commit comments