Skip to content

Conversation

paldepind
Copy link
Contributor

This makes it clear in the inline expectations what is certain and what is not certain type information.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Sep 2, 2025
@paldepind paldepind marked this pull request as ready for review September 2, 2025 09:33
@paldepind paldepind requested a review from a team as a code owner September 2, 2025 09:33
@Copilot Copilot AI review requested due to automatic review settings September 2, 2025 09:33
Copy link
Contributor

@Copilot Copilot AI left a 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) {
Copy link
Preview

Copilot AI Sep 2, 2025

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.

Suggested change
private Type inferCertainCallExprType(CallExpr ce, TypePath path) {
Type inferCertainCallExprType(CallExpr ce, TypePath path) {

Copilot uses AI. Check for mistakes.

@paldepind paldepind added the no-change-note-required This PR does not need a change note label Sep 2, 2025
@paldepind paldepind changed the title Rust: Change inline expectation annotation for certain inferred types Rust: Change inline expectation annotation for inferred certain types Sep 2, 2025
Copy link
Contributor

@hvitved hvitved left a 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.

@paldepind paldepind force-pushed the rust/certain-type-inline-expectation branch from 240377f to 8a92b2d Compare September 2, 2025 11:44
@paldepind
Copy link
Contributor Author

I assume you didn't mean to commit the empty blanket_impl.rs file? Otherwise LGTM.

Whoops, no. I've removed it.

@paldepind paldepind merged commit 17d23a9 into github:main Sep 2, 2025
19 checks passed
@paldepind paldepind deleted the rust/certain-type-inline-expectation branch September 2, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants