-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Rust: Rework type inference for method calls #20282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Rust: Rework type inference for method calls #20282
Conversation
There was a problem hiding this 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.
e4cfb86
to
4a8c37c
Compare
4a8c37c
to
e75d79e
Compare
|
||
/** | ||
* 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 Warning
61866bf
to
2d1ed65
Compare
2d1ed65
to
3d19a06
Compare
3d19a06
to
153c10b
Compare
153c10b
to
e161d4c
Compare
dd45f7b
to
a20c440
Compare
f45d2d5
to
f9f8782
Compare
pragma[nomagic] | ||
private Type inferMethodCallExprType(AstNode n, TypePath path) { | ||
exists( | ||
MethodCallMatchingInput::Access a, MethodCallMatchingInput::AccessPosition apos, string state, |
Check warning
Code scanning / CodeQL
Omittable 'exists' variable Warning
in this argument
33482c4
to
9fbda33
Compare
a9394b2
to
e4d1bfd
Compare
4dfa4cb
to
9c8c066
Compare
9f5e7e2
to
9145b99
Compare
} | ||
|
||
/** Holds if this relevant access should satisfy `constraint`. */ | ||
Type getConstraint() { relevantAccessConstraint(a, e, target, apos, path, result) } | ||
Type getConstraint(Declaration target) { |
Check warning
Code scanning / CodeQL
Missing QLDoc for parameter Warning
4d3e3ab
to
47463e3
Compare
* `self5` | `impl T2 for X` | `X` | ||
*/ | ||
private class FunctionType extends TFunctionType { | ||
private predicate asFunctionType(Function f, FunctionTypePosition pos, ImplOrTraitItemNode i) { |
Check warning
Code scanning / CodeQL
Predicates starting with "get" or "as" should return a value Warning
this = MkFunctionType(f, pos, i) | ||
} | ||
|
||
private predicate asInheritedFunctionType( |
Check warning
Code scanning / CodeQL
Predicates starting with "get" or "as" should return a value Warning
e56bc06
to
8da8b10
Compare
|
||
pragma[nomagic] | ||
private Function getACandidateTraitMethod() { | ||
exists(TraitItemNode trait, ImplOrTraitItemNode i, FunctionType self, Function resolved | |
Check warning
Code scanning / CodeQL
Omittable 'exists' variable Warning
in this argument
|
||
pragma[nomagic] | ||
private Function getACandidateTraitMethod() { | ||
exists(TraitItemNode trait, ImplOrTraitItemNode i, FunctionType self, Function resolved | |
Check warning
Code scanning / CodeQL
Omittable 'exists' variable Warning
in this argument
8da8b10
to
4f84362
Compare
832546f
to
c7d4fc3
Compare
* at `mc`. | ||
*/ | ||
pragma[inline] | ||
private predicate methodCallCandidate( |
Check warning
Code scanning / CodeQL
Missing QLDoc for parameter Warning
predicate potentialInstantiationOf( | ||
MethodCallCand mcc, TypeAbstraction abs, FunctionType constraint | ||
) { | ||
exists(MethodCall mc, string name, int arity, TypePath rootTypePath, Type rootType | |
Check warning
Code scanning / CodeQL
Omittable 'exists' variable Warning
in this argument
predicate potentialInstantiationOf( | ||
MethodCallCand mcc, TypeAbstraction abs, FunctionType constraint | ||
) { | ||
exists(MethodCall mc, string name, int arity, TypePath rootTypePath, Type rootType | |
Check warning
Code scanning / CodeQL
Omittable 'exists' variable Warning
No description provided.