Skip to content

Unified: Add a case for constructors in bindingContext - #22731

Open
hvitved wants to merge 1 commit into
github:mainfrom
hvitved:unified/binding-ctx-ctor
Open

hvitved wants to merge 1 commit into
github:mainfrom
hvitved:unified/binding-ctx-ctor

Conversation

@hvitved

@hvitved hvitved commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

On #22721 we saw a regression in statically resolvable names, which happens because we mistakenly consider constructor identifiers (init) to be resolvable, and since that PR added more constructors, it would appear we could resolve fewer names.

The fix is to handle constructors similar to other members with an identifier.

DCA confirms.

@hvitved hvitved added the no-change-note-required This PR does not need a change note label Oct 2, 2026
@hvitved
hvitved marked this pull request as ready for review October 2, 2026 07:22
@hvitved
hvitved requested a review from a team as a code owner October 2, 2026 07:22
@hvitved
hvitved requested review from asgerf and a balanced review from Copilot October 2, 2026 07:22

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.

Copilot review overview

🟡 Changes recommended

The regression fix lacks targeted test coverage for explicit or synthesized constructors.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Ensures Swift constructor identifiers are treated as declarations rather than statically resolvable references.

Changes:

  • Adds constructors to local name-binding contexts.
File Description
unified/​ql/​lib/​codeql/​unified/​internal/​LocalNameBinding.qll Classifies constructor name nodes as bindings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +289 to +293
exists(ConstructorDeclaration decl |
getChild(scope, _) = decl and
pattern = decl.getNameNode() and
declaration = decl
)

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

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