@@ -2030,11 +2030,9 @@ private module AssocFunctionResolution {
20302030 * and `borrow`.
20312031 */
20322032 pragma [ nomagic]
2033- AssocFunction resolveCallTarget (
2034- ImplOrTraitItemNode i , FunctionPosition selfPos , DerefChain derefChain , BorrowKind borrow
2035- ) {
2033+ AssocFunction resolveCallTarget ( ImplOrTraitItemNode i , DerefChain derefChain , BorrowKind borrow ) {
20362034 exists ( AssocFunctionCallCand afcc |
2037- afcc = MkAssocFunctionCallCand ( this , selfPos , _, derefChain , borrow ) and
2035+ afcc = MkAssocFunctionCallCand ( this , _ , _, derefChain , borrow ) and
20382036 result = afcc .resolveCallTarget ( i )
20392037 )
20402038 }
@@ -2047,7 +2045,7 @@ private module AssocFunctionResolution {
20472045 predicate argumentHasImplicitDerefChainBorrow ( Expr arg , DerefChain derefChain , BorrowKind borrow ) {
20482046 exists ( FunctionPosition self |
20492047 self .isSelf ( ) and
2050- exists ( this .resolveCallTarget ( _, self , derefChain , borrow ) ) and
2048+ exists ( this .resolveCallTarget ( _, derefChain , borrow ) ) and
20512049 arg = this .getNodeAt ( self ) and
20522050 not ( derefChain .isEmpty ( ) and borrow .isNoBorrow ( ) )
20532051 )
@@ -2605,24 +2603,19 @@ private module MethodCallMatchingInput implements MatchingWithEnvironmentInputSi
26052603
26062604 class AccessEnvironment = string ;
26072605
2608- bindingset [ pos, derefChain, borrow]
2609- private AccessEnvironment encodeDerefChainBorrow (
2610- FunctionPosition pos , DerefChain derefChain , BorrowKind borrow
2611- ) {
2612- result = pos + ":" + derefChain + ";" + borrow
2606+ bindingset [ derefChain, borrow]
2607+ private AccessEnvironment encodeDerefChainBorrow ( DerefChain derefChain , BorrowKind borrow ) {
2608+ result = derefChain + ";" + borrow
26132609 }
26142610
26152611 bindingset [ derefChainBorrow]
26162612 additional predicate decodeDerefChainBorrow (
2617- string derefChainBorrow , FunctionPosition pos , DerefChain derefChain , BorrowKind borrow
2613+ string derefChainBorrow , DerefChain derefChain , BorrowKind borrow
26182614 ) {
2619- exists ( int i , string rest , int j |
2620- i = derefChainBorrow .indexOf ( ":" ) and
2621- pos .toString ( ) = derefChainBorrow .prefix ( i ) and
2622- rest = derefChainBorrow .suffix ( i + 1 ) and
2623- j = rest .indexOf ( ";" ) and
2624- derefChain = rest .prefix ( j ) and
2625- borrow .toString ( ) = rest .suffix ( j + 1 )
2615+ exists ( int i |
2616+ i = derefChainBorrow .indexOf ( ";" ) and
2617+ derefChain = derefChainBorrow .prefix ( i ) and
2618+ borrow .toString ( ) = derefChainBorrow .suffix ( i + 1 )
26262619 )
26272620 }
26282621
@@ -2650,9 +2643,8 @@ private module MethodCallMatchingInput implements MatchingWithEnvironmentInputSi
26502643 private Type getInferredSelfType ( FunctionPosition pos , string derefChainBorrow , TypePath path ) {
26512644 exists ( DerefChain derefChain , BorrowKind borrow |
26522645 result = this .getSelfTypeAt ( pos , derefChain , borrow , path ) and
2653- derefChainBorrow = encodeDerefChainBorrow ( pos , derefChain , borrow ) and
2646+ derefChainBorrow = encodeDerefChainBorrow ( derefChain , borrow ) and
26542647 pos .isSelf ( )
2655- // if this.hasReceiver() then apos = pos else pos = apos.getFunctionCallAdjusted()
26562648 )
26572649 }
26582650
@@ -2673,9 +2665,9 @@ private module MethodCallMatchingInput implements MatchingWithEnvironmentInputSi
26732665 }
26742666
26752667 Method getTarget ( ImplOrTraitItemNode i , string derefChainBorrow ) {
2676- exists ( FunctionPosition pos , DerefChain derefChain , BorrowKind borrow |
2677- derefChainBorrow = encodeDerefChainBorrow ( pos , derefChain , borrow ) and
2678- result = this .resolveCallTarget ( i , pos , derefChain , borrow ) // mutual recursion; resolving method calls requires resolving types and vice versa
2668+ exists ( DerefChain derefChain , BorrowKind borrow |
2669+ derefChainBorrow = encodeDerefChainBorrow ( derefChain , borrow ) and
2670+ result = this .resolveCallTarget ( i , derefChain , borrow ) // mutual recursion; resolving method calls requires resolving types and vice versa
26792671 )
26802672 }
26812673
@@ -2726,7 +2718,7 @@ private Type inferMethodCallType0(
27262718 if a .hasReceiver ( ) then apos = pos else apos = pos .getFunctionCallAdjusted ( )
27272719 |
27282720 exists ( string derefChainBorrow |
2729- MethodCallMatchingInput:: decodeDerefChainBorrow ( derefChainBorrow , _ , derefChain , borrow )
2721+ MethodCallMatchingInput:: decodeDerefChainBorrow ( derefChainBorrow , derefChain , borrow )
27302722 |
27312723 result = MethodCallMatching:: inferAccessType ( a , derefChainBorrow , pos , path0 )
27322724 or
@@ -2999,7 +2991,7 @@ private module NonMethodCallMatchingInput implements MatchingInputSig {
29992991 exists ( ImplOrTraitItemNodeOption i , NonMethodFunctionDeclaration f |
30002992 result = TNonMethodFunctionDeclaration ( i , f )
30012993 |
3002- f = this .( AssocFunctionResolution:: AssocFunctionCall ) .resolveCallTarget ( i .asSome ( ) , _, _, _ ) // mutual recursion; resolving some associated function calls requires resolving types
2994+ f = this .( AssocFunctionResolution:: AssocFunctionCall ) .resolveCallTarget ( i .asSome ( ) , _, _) // mutual recursion; resolving some associated function calls requires resolving types
30032995 or
30042996 f = this .resolveCallTargetViaPathResolution ( ) and
30052997 f .isDirectlyFor ( i )
@@ -3106,7 +3098,7 @@ private module OperationMatchingInput implements MatchingInputSig {
31063098
31073099 Declaration getTarget ( ) {
31083100 exists ( ImplOrTraitItemNode i |
3109- result .isMethod ( i , this .resolveCallTarget ( i , _, _, _ ) ) // mutual recursion
3101+ result .isMethod ( i , this .resolveCallTarget ( i , _, _) ) // mutual recursion
31103102 )
31113103 }
31123104 }
@@ -3850,7 +3842,7 @@ private module Cached {
38503842 or
38513843 i instanceof ImplItemNode and dispatch = false
38523844 |
3853- result = call .( AssocFunctionResolution:: AssocFunctionCall ) .resolveCallTarget ( i , _, _, _ )
3845+ result = call .( AssocFunctionResolution:: AssocFunctionCall ) .resolveCallTarget ( i , _, _)
38543846 )
38553847 }
38563848
0 commit comments