Rust: Also apply adjustedAccessType in RelevantAccess#19729
Rust: Also apply adjustedAccessType in RelevantAccess#19729hvitved merged 1 commit intogithub:mainfrom
adjustedAccessType in RelevantAccess#19729Conversation
e215bef to
4739c88
Compare
4739c88 to
18392a0
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR extends the RelevantAccess machinery to account for an explicit target declaration when computing adjusted access types, replacing direct calls to getInferredType. It also updates the Rust type‐inference tests and main.rs comments to reflect now‐included unwrap calls and associated‐type bindings.
- Broadened
relevantAccessConstraintandMkRelevantAccessto carry aDeclaration targetso thatadjustedAccessTypecan be applied - Switched from
a.getInferredTypetoadjustedAccessTypeingetTypeAtandhasTypeConstraint - Updated test expectations and main.rs to register the previously missing
unwrapmethod and associated‐type occurrences
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| shared/typeinference/codeql/typeinference/internal/TypeInference.qll | Added target parameter and replaced getInferredType with adjustedAccessType |
| rust/ql/test/library-tests/type-inference/type-inference.expected | Added expected entries for the unwrap call and associated parameter inference |
| rust/ql/test/library-tests/type-inference/main.rs | Updated comment to expect method=unwrap |
Comments suppressed due to low confidence (1)
shared/typeinference/codeql/typeinference/internal/TypeInference.qll:1024
- The
toStringmethod forRelevantAccessdoesn’t include the newtargetfield, which could be valuable for debugging; consider appendingtarget.toString()to the output.
string toString() {
| ) { | ||
| exists(TypeMention constraintMention | | ||
| at = MkRelevantAccess(a, apos, prefix) and | ||
| at = MkRelevantAccess(a, _, apos, prefix) and |
There was a problem hiding this comment.
[nitpick] Using an underscore for the target parameter in MkRelevantAccess can obscure which argument is being ignored; consider naming this dummy parameter explicitly (e.g., dummyTarget) to improve readability.
| at = MkRelevantAccess(a, _, apos, prefix) and | |
| at = MkRelevantAccess(a, dummyTarget, apos, prefix) and |
redsun82
left a comment
There was a problem hiding this comment.
even though I can't fully understand how this fix works, I can see from the fixed MISSING in that test that it does work 👍
No description provided.