Skip to content

Unified: Type inference for nested types - #22866

Draft
hvitved wants to merge 2 commits into
github:mainfrom
hvitved:unified/type-inference-nested-types
Draft

hvitved wants to merge 2 commits into
github:mainfrom
hvitved:unified/type-inference-nested-types

Conversation

@hvitved

@hvitved hvitved commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@hvitved
hvitved force-pushed the unified/type-inference-nested-types branch from 2c69161 to b14b51a Compare October 21, 2026 13:57
Comment thread unified/ql/lib/utils/test/TestUtils.qll Fixed
@hvitved
hvitved force-pushed the unified/type-inference-nested-types branch 6 times, most recently from 03284cb to 0455baf Compare October 22, 2026 09:30
@hvitved
hvitved requested a max review from Copilot October 22, 2026 09:30

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

Implicit argument handling and parent-scope checks still produce incorrect or incomplete nested-type inference.

2 open issues
What changed in this PR

Extends Unified’s type inference to represent nested types and preserve their enclosing generic arguments, with Swift regression coverage.

Changes:

  • Adds parent-type parameters and qualified type names.
  • Updates type mentions and enum construction to propagate parent-type paths.
  • Adds nested-type tests and updates inference expectations.
File Description
unified/​ql/​test/​library-tests/​type-inference/​type-inference.expected Updates expected inference results.
unified/​ql/​test/​library-tests/​type-inference/​nested_types.swift Adds nested-generic, self-type, and extension coverage.
unified/​ql/​test/​library-tests/​type-inference/​generics.swift Removes a resolved MISSING annotation.
unified/​ql/​test/​library-tests/​type-inference/​classes.swift Updates the inline expected nested-type name.
unified/​ql/​lib/​codeql/​unified/​internal/​typeinference/​TypeMention.qll Adds nested-type qualification and implicit argument handling.
unified/​ql/​lib/​codeql/​unified/​internal/​typeinference/​TypeInferencePluginSwift.qll Removes Swift-specific enum plugin hooks.
unified/​ql/​lib/​codeql/​unified/​internal/​typeinference/​TypeInferencePlugin.qll Removes enum-specific hooks and wrappers.
unified/​ql/​lib/​codeql/​unified/​internal/​typeinference/​TypeInference.qll Integrates parent paths into constructor inference.
unified/​ql/​lib/​codeql/​unified/​internal/​typeinference/​Type.qll Introduces parent-type parameters and qualified names.
unified/​ql/​lib/​codeql/​unified/​internal/​AstExtra.qll Adds shared enum relationships and enum-field modeling.

Review effort: Max

Comment thread unified/ql/lib/codeql/unified/internal/typeinference/TypeMention.qll Outdated
Comment thread unified/ql/lib/codeql/unified/internal/typeinference/TypeMention.qll Outdated
@hvitved
hvitved force-pushed the unified/type-inference-nested-types branch from 0455baf to e55b569 Compare October 22, 2026 13:31
@hvitved
hvitved requested a max review from Copilot October 22, 2026 13:32

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.

🔵 Needs a closer look

Unresolved generic-inference regressions and changes to recursive type paths require fixes and human validation.

3 open issues
2 resolved since last review

Review effort: Max

Comment thread unified/ql/lib/codeql/unified/internal/typeinference/TypeMention.qll Outdated
Comment thread unified/ql/lib/codeql/unified/internal/typeinference/TypeMention.qll Outdated

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.

🔵 Needs a closer look

Recursive generic substitution and constructor propagation have unresolved correctness concerns and need expert validation.

2 open issues
3 resolved since last review

Review effort: Max

Comment on lines +149 to +152
this =
any(MemberAccessExpr mae |
exists(TypePath suffix |
result = mae.getBase().(TypeMention).getTypeAt(suffix) and
Comment on lines +731 to +732
tp = receiverType.getATypeParameter() and
path0 = TypePath::singleton(tp)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants