Skip to content

Unified: use type-inferred field resolution in data flow - #22980

Merged
hvitved merged 2 commits into
mainfrom
hvitved-unified-field-resolution
Nov 18, 2026
Merged

hvitved merged 2 commits into
mainfrom
hvitved-unified-field-resolution

Conversation

@hvitved

@hvitved hvitved commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Name-based member content conflates unrelated fields with the same name. Use field resolution from type inference where available to distinguish resolved fields, while retaining name-based fallback for unresolved accesses and compatibility with flow summaries.

DCA is uneventful.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The change can multiply read candidates across unrelated receiver types and drop valid data flow when only some receiver alternatives resolve to fields.

2 open issues
What changed in this PR

Updates Unified’s data-flow model to distinguish fields using type-inferred declarations, while retaining name-based fallback and compatibility with flow summaries.

Changes:

  • Adds resolved-field content and name-based read compatibility.
  • Routes qualified and implicit member reads and stores through field resolution.
  • Adds Swift regression cases, a field-read summary model, and updated expected output.
File Description
unified/​ql/​test/​library-tests/​dataflow/​test.ext.yml Adds a name-based field-read flow summary.
unified/​ql/​test/​library-tests/​dataflow/​test.expected Updates expected flow paths for the changed model and new cases.
unified/​ql/​test/​library-tests/​dataflow/​fields.swift Covers resolved, inherited, unresolved, and summarized field accesses.
unified/​ql/​lib/​codeql/​unified/​internal/​dataflow/​DataFlowGraph.qll Uses resolved content for member reads and stores.
unified/​ql/​lib/​codeql/​unified/​internal/​dataflow/​Content.qll Introduces resolved-field identities, fallback selection, and name-based compatibility.

Review effort: Max

@hvitved
hvitved force-pushed the hvitved-unified-field-resolution branch 3 times, most recently from 6524f1a to 2797f96 Compare November 3, 2026 12:42
@hvitved
hvitved requested a max review from Copilot November 3, 2026 19:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The accessor-resolution guard drops valid member data flow by suppressing name-based fallback for observer-only accesses, modeled member names, and unresolved receiver alternatives.

2 open issues
2 resolved since last review

Review effort: Max

ContentSet member(Expr access) {
result.asSingleton().asField() = T::resolveFieldAccess(access)
or
not exists(T::resolveFieldAccess(access)) and
result.asSingleton().asField() = T::resolveFieldAccess(access)
or
not exists(T::resolveFieldAccess(access)) and
not exists(T::resolveAccessorAccess(access)) and
@hvitved
hvitved force-pushed the hvitved-unified-field-resolution branch 3 times, most recently from 668d51f to 43332c6 Compare November 5, 2026 09:01
@hvitved

hvitved commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author
Rerun has been triggered: 4 restarted 🚀

hvitved and others added 2 commits November 16, 2026 12:49
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@hvitved
hvitved force-pushed the hvitved-unified-field-resolution branch from 43332c6 to 3a89ca5 Compare November 16, 2026 11:51
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Nov 17, 2026
@hvitved
hvitved marked this pull request as ready for review November 17, 2026 08:44
@hvitved
hvitved requested a review from a team as a code owner November 17, 2026 08:44
@hvitved
hvitved requested a review from asgerf November 17, 2026 08:45
@hvitved
hvitved merged commit 698dc3a into main Nov 18, 2026
18 checks passed
@hvitved
hvitved deleted the hvitved-unified-field-resolution branch November 18, 2026 13:32
@hvitved
hvitved restored the hvitved-unified-field-resolution branch November 18, 2026 13:32
@hvitved
hvitved deleted the hvitved-unified-field-resolution branch November 18, 2026 13:33
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 Unified

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants