@@ -1158,7 +1158,7 @@ private module MethodCallResolution {
11581158 methodCallVisibleTraitCandidate ( mc , impl .resolveTraitTy ( ) )
11591159 }
11601160
1161- pragma [ nomagic ]
1161+ pragma [ inline ]
11621162 private predicate methodCallCandidate (
11631163 MethodCall mc , Type type , ImplOrTraitItemNode i , FunctionPositionType self , TypePath selfPath ,
11641164 Type selfType
@@ -1250,44 +1250,16 @@ private module MethodCallResolution {
12501250 derefChainBorrow ) , i , self )
12511251 }
12521252
1253- // pragma[nomagic]
1254- // predicate blah(
1255- // Type type, ImplOrTraitItemNode i, FunctionPositionType self, TypePath selfPath, Type selfType,
1256- // string derefChainBorrow
1257- // ) {
1258- // selfType != this.getACandidateReceiverTypeAt(selfPath, derefChainBorrow) and
1259- // methodCallCandidate(this, type, i, self, selfPath, selfType)
1260- // }
1261- // idOfImplOrTraitItemNode
1262- // pragma[nomagic]
1263- // private ImplOrTraitItemNode getARankedCandidate(TypePath path, string derefChain) {
1264- // result = this.getACandidateReceiverTypeAtNoBorrow(path, derefChain) and
1265- // exists(Type type, string name, int arity, string derefChainBorrow |
1266- // derefChainBorrow = derefChain + ";" and
1267- // not derefChain.matches("%.ref") and // no need to try a borrow if the last thing we did was a deref
1268- // this.isMethodCall0(type, name, arity, derefChainBorrow)
1269- // |
1270- // forall(ImplOrTraitItemNode i, FunctionPositionType self, TypePath selfPath, Type selfType |
1271- // methodCallCandidate(this, type, i, self, selfPath, selfType)
1272- // |
1273- // this.blah(type, i, self, selfPath, selfType, derefChainBorrow)
1274- // or
1275- // this.isNotCandidate(i, self, derefChainBorrow)
1276- // )
1277- // )
1278- // }
12791253 pragma [ nomagic]
12801254 private predicate getACandidateReceiverTypeAtNoBorrowNoMatch0 ( string derefChain ) {
1281- exists ( Type type , string name , int arity , string derefChainBorrow |
1255+ exists ( Type type , string derefChainBorrow |
12821256 derefChainBorrow = derefChain + ";" and
12831257 not derefChain .matches ( "%.ref" ) and // no need to try a borrow if the last thing we did was a deref
1284- this .isMethodCall0 ( type , name , arity , derefChainBorrow )
1258+ this .isMethodCall0 ( type , _ , _ , derefChainBorrow )
12851259 |
1286- forall ( ImplOrTraitItemNode i , FunctionPositionType self , TypePath selfPath , Type selfType |
1287- methodCallCandidate ( this , type , i , self , selfPath , selfType )
1260+ forall ( ImplOrTraitItemNode i , FunctionPositionType self |
1261+ methodCallCandidate ( this , type , i , self , _ , _ )
12881262 |
1289- // this.blah(type, i, self, selfPath, selfType, derefChainBorrow)
1290- // or
12911263 this .isNotCandidate ( i , self , derefChainBorrow )
12921264 )
12931265 )
@@ -1297,32 +1269,20 @@ private module MethodCallResolution {
12971269 private Type getACandidateReceiverTypeAtNoBorrowNoMatch ( TypePath path , string derefChain ) {
12981270 result = this .getACandidateReceiverTypeAtNoBorrow ( path , derefChain ) and
12991271 this .getACandidateReceiverTypeAtNoBorrowNoMatch0 ( derefChain )
1300- // exists(Type type, string name, int arity, string derefChainBorrow |
1301- // derefChainBorrow = derefChain + ";" and
1302- // not derefChain.matches("%.ref") and // no need to try a borrow if the last thing we did was a deref
1303- // this.isMethodCall0(type, name, arity, derefChainBorrow)
1304- // |
1305- // forall(ImplOrTraitItemNode i, FunctionPositionType self, TypePath selfPath, Type selfType |
1306- // methodCallCandidate(this, type, i, self, selfPath, selfType)
1307- // |
1308- // this.blah(type, i, self, selfPath, selfType, derefChainBorrow)
1309- // or
1310- // this.isNotCandidate(i, self, derefChainBorrow)
1311- // )
1312- // )
1272+ }
1273+
1274+ pragma [ nomagic]
1275+ private predicate hasRefCandidate ( ImplOrTraitItemNode i , FunctionPositionType self ) {
1276+ methodCallCandidate ( this , TRefType ( ) , i , self , _, _)
13131277 }
13141278
13151279 pragma [ nomagic]
13161280 private predicate getACandidateReceiverTypeAtNoMatch0 ( string derefChain ) {
1317- exists ( Type type , string name , int arity , string derefChainBorrow |
1281+ exists ( string derefChainBorrow |
13181282 derefChainBorrow = derefChain + ";borrow" and
1319- this .isMethodCall0 ( type , name , arity , derefChainBorrow )
1283+ this .isMethodCall0 ( _ , _ , _ , derefChainBorrow )
13201284 |
1321- forall ( ImplOrTraitItemNode i , FunctionPositionType self , TypePath selfPath , Type selfType |
1322- methodCallCandidate ( this , type , i , self , selfPath , selfType )
1323- |
1324- // this.blah(type, i, self, selfPath, selfType, derefChainBorrow)
1325- // or
1285+ forall ( ImplOrTraitItemNode i , FunctionPositionType self | this .hasRefCandidate ( i , self ) |
13261286 this .isNotCandidate ( i , self , derefChainBorrow )
13271287 )
13281288 )
@@ -1332,18 +1292,6 @@ private module MethodCallResolution {
13321292 private Type getACandidateReceiverTypeAtNoMatch ( TypePath path , string derefChain ) {
13331293 result = this .getACandidateReceiverTypeAtNoBorrowNoMatch ( path , derefChain ) and
13341294 this .getACandidateReceiverTypeAtNoMatch0 ( derefChain )
1335- // exists(Type type, string name, int arity, string derefChainBorrow |
1336- // derefChainBorrow = derefChain + ";borrow" and
1337- // this.isMethodCall0(type, name, arity, derefChainBorrow)
1338- // |
1339- // forall(ImplOrTraitItemNode i, FunctionPositionType self, TypePath selfPath, Type selfType |
1340- // methodCallCandidate(this, type, i, self, selfPath, selfType)
1341- // |
1342- // this.blah(type, i, self, selfPath, selfType, derefChainBorrow)
1343- // or
1344- // this.isNotCandidate(i, self, derefChainBorrow)
1345- // )
1346- // )
13471295 }
13481296
13491297 /**
@@ -1560,7 +1508,7 @@ private module MethodCallResolution {
15601508 }
15611509
15621510 predicate relevantTypeMention ( FunctionPositionType constraint ) {
1563- methodCallCandidate ( _, _, _, constraint , _, _)
1511+ methodCandidate ( _ , _, _, _, constraint , _, _)
15641512 }
15651513 }
15661514
@@ -1579,7 +1527,7 @@ private module MethodCallResolution {
15791527 }
15801528
15811529 predicate relevantTypeMention ( FunctionPositionType constraint ) {
1582- methodCallCandidate ( _, _, _, constraint , _, _)
1530+ methodCandidate ( _ , _, _, _, constraint , _, _)
15831531 }
15841532 }
15851533
@@ -1595,7 +1543,7 @@ private module MethodCallResolution {
15951543 }
15961544
15971545 predicate relevantTypeMention ( FunctionPositionType constraint ) {
1598- methodCallCandidate ( _, _, _, constraint , _, _)
1546+ methodCandidate ( _ , _, _, _, constraint , _, _)
15991547 }
16001548 }
16011549}
0 commit comments