Skip to content

Unified: Fix bug in UnqualifiedMemberAccess.getAccessingClass() - #23033

Draft
hvitved wants to merge 2 commits into
github:mainfrom
hvitved:unified/static-name-binding-prevent-self-inheritence
Draft

hvitved wants to merge 2 commits into
github:mainfrom
hvitved:unified/static-name-binding-prevent-self-inheritence

Conversation

@hvitved

@hvitved hvitved commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@hvitved
hvitved force-pushed the unified/static-name-binding-prevent-self-inheritence branch from 685e67e to 839aba2 Compare November 5, 2026 21:16

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 lookup guard leaves valid Swift references such as Node.Leaf.Leaf unbound and causes subclasses to lose inherited type bindings.

1 open issue
What changed in this PR

Updates unified static name binding to address incorrect results from UnqualifiedMemberAccess.getAccessingClass() for nested Swift subclasses.

Changes:

  • Add self-inheritance filtering to member lookup.
  • Remove binding pragmas from unqualified-access candidate resolution.
  • Add a Swift regression fixture and query output for accessing classes.
File Description
unified/​ql/​test/​library-tests/​static-name-binding/​unqualified-access.swift Adds the nested Node.Leaf regression case.
unified/​ql/​test/​library-tests/​static-name-binding/​test.ql Queries unqualified accesses and their accessing classes.
unified/​ql/​test/​library-tests/​static-name-binding/​test.expected Records expected accessing-class query results.
unified/​ql/​lib/​codeql/​unified/​internal/​StaticNameBinding.qll Filters self-inheritance and updates candidate resolution.

Review effort: Max

Comment on lines +452 to +455
not exists(ClassLikeDeclaration self |
this.isStaticMemberNamespace(self) and
n.isMember(self)
)

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.

2 participants