-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Rust: Change inline expectation annotation for inferred certain types #20343
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
Rust: Change inline expectation annotation for inferred certain types #20343
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.
Pull Request Overview
This PR enhances the type inference testing framework to distinguish between certain and uncertain type information in inline expectations. The changes introduce a new "certainType" annotation to clearly mark type information that can be inferred with certainty versus general type information that may be less reliable.
- Modifies the type inference test query to support both "type" and "certainType" tags
- Updates test expectations throughout to use "certainType" for known certain type inferences
- Exposes the CertainTypeInference module to enable differentiation between certain and uncertain type information
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
rust/ql/test/library-tests/type-inference/type-inference.ql | Updates test framework to distinguish certain vs uncertain type inference |
rust/ql/lib/codeql/rust/internal/TypeInference.qll | Exposes CertainTypeInference module and adjusts visibility |
rust/ql/test/library-tests/type-inference/pattern_matching.rs | Updates test expectations to use certainType for certain inferences |
rust/ql/test/library-tests/type-inference/main.rs | Updates test expectations to use certainType for certain inferences |
rust/ql/test/library-tests/type-inference/closure.rs | Updates test expectations to use certainType for certain inferences |
@@ -286,7 +286,7 @@ private module CertainTypeInference { | |||
} | |||
|
|||
pragma[nomagic] | |||
Type inferCertainCallExprType(CallExpr ce, TypePath path) { | |||
private Type inferCertainCallExprType(CallExpr ce, TypePath path) { |
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.
The function inferCertainCallExprType
is made private but the module CertainTypeInference
is now public. If this function is intended to be part of the public API for certain type inference, it should be made public as well.
private Type inferCertainCallExprType(CallExpr ce, TypePath path) { | |
Type inferCertainCallExprType(CallExpr ce, TypePath path) { |
Copilot uses AI. Check for mistakes.
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.
I assume you didn't mean to commit the empty blanket_impl.rs
file? Otherwise LGTM.
240377f
to
8a92b2d
Compare
Whoops, no. I've removed it. |
This makes it clear in the inline expectations what is certain and what is not certain type information.