@@ -1570,40 +1570,40 @@ private class FunctionCallExpr extends CallExpr {
1570
1570
}
1571
1571
1572
1572
pragma [ nomagic]
1573
- Function getAnAmbigousCandiate ( ImplItemNode impl , int pos ) {
1574
- exists ( TraitItemNode trait , Function traitFunction |
1573
+ Function getAnAmbigousCandiate ( ImplItemNode impl , int pos , Function f ) {
1574
+ exists ( TraitItemNode trait |
1575
1575
trait = this .getTrait ( ) and
1576
- traitFunction = this .getResolvedFunction ( ) and
1577
- result .implements ( traitFunction ) and
1576
+ f = this .getResolvedFunction ( ) and
1577
+ result .implements ( f ) and
1578
1578
result = impl .getAnAssocItem ( )
1579
1579
|
1580
1580
assocFuncResolutionDependsOnArgument ( result , impl , pos )
1581
1581
or
1582
1582
not assocFuncResolutionDependsOnArgument ( result , _, _) and
1583
- traitTypeParameterOccurrence ( trait , traitFunction , _, pos , _)
1583
+ traitTypeParameterOccurrence ( trait , f , _, pos , _)
1584
1584
)
1585
1585
or
1586
- result = this .getResolvedFunction ( ) and
1586
+ f = this .getResolvedFunction ( ) and
1587
+ result = f and
1587
1588
assocFuncResolutionDependsOnArgument ( result , impl , pos )
1588
1589
}
1589
1590
1590
- Function getAnAmbigousCandiate ( ImplItemNode impl , int pos , int rnk ) {
1591
- pos = rank [ rnk + 1 ] ( int pos0 | result = this .getAnAmbigousCandiate ( impl , pos0 ) | pos0 )
1591
+ Function getAnAmbigousCandiate ( ImplItemNode impl , int pos , Function f , int rnk ) {
1592
+ pos = rank [ rnk + 1 ] ( int pos0 | result = this .getAnAmbigousCandiate ( impl , pos0 , f ) | pos0 )
1592
1593
}
1593
1594
}
1594
1595
1595
1596
private newtype TAmbigousAssocFunctionCallExpr =
1596
- MkAmbigousAssocFunctionCallExpr ( FunctionCallExpr call , Function f , ImplItemNode impl , int pos ) {
1597
- f = call .getAnAmbigousCandiate ( impl , pos )
1597
+ MkAmbigousAssocFunctionCallExpr ( FunctionCallExpr call , Function f , int pos ) {
1598
+ exists ( call .getAnAmbigousCandiate ( _ , pos , f ) )
1598
1599
}
1599
1600
1600
1601
private class AmbigousAssocFunctionCallExpr extends MkAmbigousAssocFunctionCallExpr {
1601
1602
FunctionCallExpr call ;
1602
1603
Function f ;
1603
- ImplItemNode impl_ ;
1604
1604
int pos ;
1605
1605
1606
- AmbigousAssocFunctionCallExpr ( ) { this = MkAmbigousAssocFunctionCallExpr ( call , f , impl_ , pos ) }
1606
+ AmbigousAssocFunctionCallExpr ( ) { this = MkAmbigousAssocFunctionCallExpr ( call , f , pos ) }
1607
1607
1608
1608
pragma [ nomagic]
1609
1609
Type getTypeAt ( TypePath path ) {
@@ -1625,7 +1625,10 @@ private module AmbigousAssocFuncIsInstantiationOfInput implements
1625
1625
predicate potentialInstantiationOf (
1626
1626
AmbigousAssocFunctionCallExpr ce , TypeAbstraction impl , TypeMention constraint
1627
1627
) {
1628
- exists ( Function cand , int pos | ce = MkAmbigousAssocFunctionCallExpr ( _, cand , impl , pos ) |
1628
+ exists ( FunctionCallExpr call , Function f , Function cand , int pos |
1629
+ ce = MkAmbigousAssocFunctionCallExpr ( call , f , pos ) and
1630
+ cand = call .getAnAmbigousCandiate ( impl , pos , f )
1631
+ |
1629
1632
constraint = cand .getParam ( pos ) .getTypeRepr ( )
1630
1633
or
1631
1634
pos = - 1 and
@@ -1645,10 +1648,10 @@ private ItemNode resolveUnambigousFunctionCallTarget(FunctionCallExpr call) {
1645
1648
1646
1649
pragma [ nomagic]
1647
1650
private Function resolveAmbigousFunctionCallTargetFromIndex ( FunctionCallExpr call , int index ) {
1648
- exists ( Impl impl , int pos |
1651
+ exists ( Impl impl , int pos , Function f |
1649
1652
IsInstantiationOf< AmbigousAssocFunctionCallExpr , AmbigousAssocFuncIsInstantiationOfInput > :: isInstantiationOf ( MkAmbigousAssocFunctionCallExpr ( call ,
1650
- result , _ , pos ) , impl , _) and
1651
- result = call .getAnAmbigousCandiate ( impl , pos , index )
1653
+ f , pos ) , impl , _) and
1654
+ result = call .getAnAmbigousCandiate ( impl , pos , f , index )
1652
1655
|
1653
1656
index = 0
1654
1657
or
@@ -1663,7 +1666,7 @@ pragma[nomagic]
1663
1666
private Function resolveAmbigousFunctionCallTarget ( FunctionCallExpr call ) {
1664
1667
result =
1665
1668
resolveAmbigousFunctionCallTargetFromIndex ( call ,
1666
- max ( int index | result = call .getAnAmbigousCandiate ( _, _, index ) ) )
1669
+ max ( int index | result = call .getAnAmbigousCandiate ( _, _, _ , index ) ) )
1667
1670
}
1668
1671
1669
1672
pragma [ inline]
0 commit comments