Skip to content

Conversation

hvitved
Copy link
Contributor

@hvitved hvitved commented Aug 25, 2025

No description provided.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Aug 25, 2025
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@hvitved hvitved force-pushed the rust/type-inference-method-call-resolution-rework branch 2 times, most recently from e4cfb86 to 4a8c37c Compare August 26, 2025 18:30
class State = string;

// private newtype TAccess =
// TMethodCallAccess(MethodCallDerefChainRef mcd) or

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
// // t0 = getTypeQualifier(this, path0) and
// // apos.getArgumentPosition(false).isSelf() and
// // exists(state)
// // else (

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
// )
// }
// bindingset[state]
// pragma[nomagic]

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
// .getParameterType(TArgumentDeclarationPosition(apos.getArgumentPosition()),
// TypePath::nil())
// |
// if selfParamType = TRefType()

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.

pragma[nomagic]
private Type getACandidateReceiverTypeAtNoMatch(TypePath path, string derefChain) {
this.receiverImplicitlyBorrowed() and

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
private Type getACandidateReceiverTypeAtRef(TypePath path, string derefChain) {
// exists(TypePath path0, Type t0, string derefChain |
// t0 = this.getACandidateReceiverTypeAt(path0, derefChain)
// |

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.

pragma[nomagic]
private Type testgetACandidateReceiverTypeAtRefNoMatch2(
TypePath path, string derefChain, Type rootType, string name, int arity

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.

pragma[nomagic]
private Type testgetACandidateReceiverTypeRefsAt(TypePath path, string derefChain) {
result = this.getACandidateReceiverTypeRefsAt(path, derefChain) and

Check warning

Code scanning / CodeQL

Singleton set literal

Singleton set literal can be replaced by its member.
@@ -1087,10 +1094,11 @@
* For example, if this access is the method call `M(42)`, then the inferred
* type at argument position `0` is `int`.
*/
Type getInferredType(AccessPosition apos, TypePath path);
bindingset[state]

Check warning

Code scanning / CodeQL

Missing QLDoc for parameter

The QLDoc has no documentation for state, but the QLDoc mentions int
@hvitved hvitved force-pushed the rust/type-inference-method-call-resolution-rework branch from 4a8c37c to e75d79e Compare August 27, 2025 15:34
if
apos.isReturn() and
(this instanceof DerefExpr or this instanceof IndexExpr)
then (

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
}

pragma[nomagic]
private Type testgetACandidateReceiverTypeAtNoMatch(TypePath path, string derefChain) {

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
// not exists(resolveNonImplMethodCallTarget(rootType, name, arity))
)
}

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
)
)
}

bindingset[trait, name]
pragma[inline_late]
private Function getImplTraitMethod(ImplTraitReturnType trait, string name) {
result = getMethodSuccessor(trait.getImplTraitTypeRepr(), name)
private Function getImplTraitMethod(ImplTraitReturnType trait, string name, int arity) {

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
}

bindingset[traitObject, name]
pragma[inline_late]
private Function getDynTraitMethod(DynTraitType traitObject, string name) {
result = getMethodSuccessor(traitObject.getTrait(), name)
private Function getDynTraitMethod(DynTraitType traitObject, string name, int arity) {

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
or
bindingset[t, name, arity]
pragma[inline_late]
private Function resolveNonImplMethodCallTarget(Type t, string name, int arity) {

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.

/**
* Holds if `constraint` might occur as the third argument of
* `potentialInstantiationOf`. Defaults to simply projecting the third
* argument of `potentialInstantiationOf`.
*/
default predicate relevantTypeMention(TypeMention tm) { potentialInstantiationOf(_, _, tm) }
default predicate relevantTypeMention(Constraint tm) { potentialInstantiationOf(_, _, tm) }

Check warning

Code scanning / CodeQL

Missing QLDoc for parameter

The QLDoc has no documentation for tm, but the QLDoc mentions constraint
@hvitved hvitved force-pushed the rust/type-inference-method-call-resolution-rework branch 8 times, most recently from 61866bf to 2d1ed65 Compare September 1, 2025 09:45
bindingset[s]
private predicate isBorrowed(string s) { exists(s.splitAt(";", 1)) }

private predicate sdf() { isBorrowed(";ref") }

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
tAdj = t
}
pragma[nomagic]
private Type testinferMethodCallExprType(

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
}

private module CallExprBaseMatching = Matching<CallExprBaseMatchingInput>;
private Type testinferMethodCallExprType0(

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
result = getFieldExprLookupType(fe, name) and
pos = name.toInt()
)
private Type testinferMethodCallExprType(AstNode n, TypePath path) {

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
result = TTupleTypeParameter(arity, i)
private Type inferMethodCallExprType(AstNode n, TypePath path) {
exists(
MethodCallExprMatchingInput::Access a, MethodCallExprMatchingInput::AccessPosition apos,

Check warning

Code scanning / CodeQL

Omittable 'exists' variable

This exists variable can be omitted by using a don't-care expression [in this argument](1).
or
exists(int pos, TypePath path, Type type |
functionResolutionDependsOnArgument(impl, name, result, pos + 1, pragma[only_bind_into](path),
type) and

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
or
exists(int pos0 | constraint = cand.getParam(pos0).getTypeRepr() |
if cand.getParamList().hasSelfParam() then pos = pos0 + 1 else pos = pos0
)

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
@hvitved hvitved force-pushed the rust/type-inference-method-call-resolution-rework branch from 2d1ed65 to 3d19a06 Compare September 1, 2025 10:30
// getSelfParamTypeMention(getTypeParameterMethod(t, name, arity).getParamList().getSelfParam())
}

private Function testgetMethodFromImpl(

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
@hvitved hvitved force-pushed the rust/type-inference-method-call-resolution-rework branch from 3d19a06 to 153c10b Compare September 1, 2025 17:56
result = this.getAnAmbigousCandidate(impl, pos, resolved) and
this = Debug::getRelevantLocatable()
}

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
@hvitved hvitved force-pushed the rust/type-inference-method-call-resolution-rework branch from 153c10b to e161d4c Compare September 1, 2025 18:35
MethodCallDerefChainRef mc, TypeAbstraction abs, SelfParamType constraint
) {
// mc.getMethodCall() = Debug::getRelevantLocatable() and
exists(Type rootType, string name, int arity, MethodCall mc0 |

Check warning

Code scanning / CodeQL

Omittable 'exists' variable

This exists variable can be omitted by using a don't-care expression [in this argument](1).
op = Debug::getRelevantLocatable()
}

private Function testresolveOperation(Op op, ImplOrTraitItemNode impl, string name) {

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.

/** Gets a method from an `impl` block that matches the method call `mc`. */
pragma[nomagic]
private Function resolveOperation(Op op) {

Check warning

Code scanning / CodeQL

Missing QLDoc for parameter

The QLDoc has no documentation for op, but the QLDoc mentions mc
@hvitved hvitved force-pushed the rust/type-inference-method-call-resolution-rework branch from dd45f7b to a20c440 Compare September 2, 2025 07:24
trait = resolvePath(impl.(ImplItemNode).getTraitPath()) and
methodCandidate(type, name, arity, impl)
pragma[nomagic]
private Type getTypeAtsdf(TypePath path) {

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
)
}

predicate relevantTypeMention(TypeMention constraint) {
exists(Impl impl | methodCandidate(_, _, _, impl) and constraint = impl.getSelfTy())
predicate testpotentialInstantiationOf(Op op, TypeAbstraction abs, SelfParamType constraint) {

Check warning

Code scanning / CodeQL

Dead code

This code is never used, and it's not publicly exported.
@hvitved hvitved force-pushed the rust/type-inference-method-call-resolution-rework branch from a20c440 to ffc9e72 Compare September 2, 2025 07:37
@hvitved hvitved force-pushed the rust/type-inference-method-call-resolution-rework branch from ffc9e72 to 5290008 Compare September 2, 2025 07:45
@hvitved hvitved force-pushed the rust/type-inference-method-call-resolution-rework branch from 5290008 to 06a8539 Compare September 2, 2025 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant