Rust: Change inline expectation annotation for inferred certain types#20343
Conversation
There was a problem hiding this comment.
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 |
|
|
||
| pragma[nomagic] | ||
| Type inferCertainCallExprType(CallExpr ce, TypePath path) { | ||
| private Type inferCertainCallExprType(CallExpr ce, TypePath path) { |
There was a problem hiding this comment.
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) { |
hvitved
left a comment
There was a problem hiding this comment.
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.