@@ -1066,7 +1066,7 @@ private module MethodResolution {
10661066 }
10671067
10681068 /**
1069- * A method call.
1069+ * A (potential) method call.
10701070 *
10711071 * This is either:
10721072 *
@@ -1080,6 +1080,9 @@ private module MethodResolution {
10801080 *
10811081 * Note that only in case 1 and 2 is auto-dereferencing and borrowing allowed.
10821082 *
1083+ * Note also that only case 4 is a _potential_ method call; in all other cases, we are
1084+ * guaranteed that the target is a method.
1085+ *
10831086 * [1]: https://doc.rust-lang.org/std/ops/trait.Index.html
10841087 */
10851088 abstract class MethodCall extends Expr {
@@ -1137,10 +1140,6 @@ private module MethodResolution {
11371140 private predicate hasIncompatibleTarget ( ImplOrTraitItemNode i , string derefChain , boolean borrow ) {
11381141 ReceiverIsInstantiationOfSelfParam:: argIsNotInstantiationOf ( MkMethodCallCand ( this , derefChain ,
11391142 borrow ) , i , _)
1140- or
1141- TypeQualifierIsInstantiationOfImplSelf:: isNotInstantiationOf ( this , i , _) and
1142- derefChain = "" and
1143- borrow = false
11441143 }
11451144
11461145 /**
@@ -1168,8 +1167,6 @@ private module MethodResolution {
11681167 // todo: also check that all blanket implementation candidates are incompatible
11691168 forall ( ImplOrTraitItemNode i |
11701169 methodCallNonBlanketCandidate ( this , _, i , _, strippedTypePath , strippedType )
1171- or
1172- this .( MethodCallCallExpr ) .hasTypeQualifiedCandidate ( i )
11731170 |
11741171 this .hasIncompatibleTarget ( i , derefChain , borrow )
11751172 )
@@ -1312,7 +1309,7 @@ private module MethodResolution {
13121309 *
13131310 * When this is the case, we still want to check that the type qualifier
13141311 * is an instance of the type being implemented, which is done in
1315- * `MethodCallCallExprIsInstantiationOfInput `.
1312+ * `TypeQualifierIsInstantiationOfImplSelfInput `.
13161313 */
13171314 pragma [ nomagic]
13181315 predicate hasTypeQualifiedCandidate ( ImplItemNode impl ) {
@@ -1333,7 +1330,7 @@ private module MethodResolution {
13331330 result = this .getArgList ( ) .getArg ( pos .asPosition ( ) + 1 )
13341331 }
13351332
1336- // needed for `MethodCallCallExprIsInstantiationOfInput `
1333+ // needed for `TypeQualifierIsInstantiationOfImplSelfInput `
13371334 Type getTypeAt ( TypePath path ) {
13381335 result = substituteLookupTraits ( getCallExprTypeQualifier ( this , path ) )
13391336 }
@@ -1558,8 +1555,8 @@ private module MethodResolution {
15581555 /**
15591556 * A configuration for matching the type qualifier of a method call
15601557 * against the type being implemented in an `impl` block. For example,
1561- * in `Q:: m(x)`, we check that the type of `Q ` is an instance of the
1562- * type being implemented.
1558+ * in `Foo::<Bar>:: m(x)`, we check that the type `Foo<Bar> ` is an
1559+ * instance of the type being implemented.
15631560 */
15641561 private module TypeQualifierIsInstantiationOfImplSelfInput implements
15651562 IsInstantiationOfInputSig< MethodCallCallExpr , TypeMentionTypeTree >
@@ -1909,7 +1906,7 @@ private module NonMethodResolution {
19091906
19101907 private module BlanketTraitIsVisible = TraitIsVisible< blanketCallTraitCandidate / 2 > ;
19111908
1912- /** A non-method call, `f(x)`. */
1909+ /** A (potential) non-method call, `f(x)`. */
19131910 final class NonMethodCall extends CallExpr {
19141911 NonMethodCall ( ) {
19151912 // even if a function cannot be resolved by path resolution, it may still
0 commit comments