Repository navigation
Conversation
hvitved
force-pushed
the
unified/static-name-binding-prevent-self-inheritence
branch
from
November 5, 2026 21:16
685e67e to
839aba2
Compare
Contributor
There was a problem hiding this comment.
🟡 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
hvitved
force-pushed
the
unified/static-name-binding-prevent-self-inheritence
branch
from
November 6, 2026 08:20
839aba2 to
c68de99
Compare
UnqualifiedMemberAccess.getAccessingClass()UnqualifiedMemberAccess.getAccessingClass()
hvitved
force-pushed
the
unified/static-name-binding-prevent-self-inheritence
branch
from
November 9, 2026 08:30
c68de99 to
3da2f7b
Compare
UnqualifiedMemberAccess.getAccessingClass()UnqualifiedMemberAccess name binding tests
hvitved
marked this pull request as ready for review
November 9, 2026 08:39
asgerf
approved these changes
Nov 9, 2026
asgerf
left a comment
Contributor
There was a problem hiding this comment.
Weird situation, but yes I agree this is technically correct for what getAccessingClass does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


As suggested by @asgerf, I want to use
UnqualifiedMemberAccess.getAccessingClassin #22866 for determining implicit nested type qualifiers. However, it cannot always be used directly in cases likewhere the unqualified
Leafaccess getsNode.Leafas accessing class instead ofNode. I think this is what we want forgetAccessingClass, though, so this PR is only about documenting this intent with a test case.