Repository navigation
fix(swift): classify private nested types by their own kind - #10085
Merged
morluto merged 3 commits intoNov 11, 2026
Merged
Conversation
Skip swiftc's file discriminator before the nominal marker so a private nested enum, struct, or class is not filed under its enclosing type.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
The original workflow runs stayed queued while later runs on other pull requests completed.
This was referenced Nov 11, 2026
3 tasks done
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.
Summary
Closes #7501
analyze_swift_typesfiles members of a private nested enum, struct, or class under the enclosing type. swiftc places a<length>_<hex>LLfile discriminator between the nested name and its own nominal kind, and the classifier was reading that length as the kind.Problem and expected behavior
_$s4main8EnvelopeV5State33_06D5FEE0226E625B433890B34489ED31LLO8describeSSyF(Envelope.State.describe, private nested enum).Lwas not a nominal marker, and the member kept the enclosing struct category.LLselects the category (Oenum,Vstruct,Cclass). A private method on the enclosing type stays in that type's category. A length-prefixed identifier that does not start with_is not treated as this discriminator.Change and scope
classifySwiftSymbolskips a file discriminator (<length>_<hex>LL) before reading the nominal marker. Zero-prefixed identifiers, substituted contexts, and symbols without this discriminator are unchanged.Closed #7518 attempted the same correction but was closed because its branch replayed unrelated history. This branch contains only the classifier change and its regression.
Contribution scope: ordinary classification fix inside the existing Swift symbol decoder. Maintainer scope decision: not applicable.
Contract and boundary impact
classifySwiftSymbolin the domain layer, before CLI/MCP category projection. Symbol strings and procedure identity are unchanged.analyze_swift_typeskeeps the same inputs and category names; affected symbols move between existing categories.docs/public/product-catalog.json), package, or installation impact: none.Expected effects:
No new target interaction. The change only reclassifies symbol strings already passed to the Swift category decoder.
Evidence and regression coverage
src/domain/symbolAnalysis.test.tscovers a private nested enum, struct, and class, a private method that stays on the enclosing struct, and a non-discriminatorLLthat stays on the enclosing class. The private enum is absent from the structs filter.upstream/mainat37d2d207d, with only the new test applied,npm run test:focused -- src/domain/symbolAnalysis.test.tsfailed that case (enums filter total 0). With this change the same file passes, 23 tests.analyze_swift_typesreports those members under the nested type's category instead of the enclosing type's.analyze_swift_typesfiles members of private nested types under the enclosing type's category #7501, not a rebuilt binary.Boundary regressions: category projection from an already decoded mangled name. Lifecycle regressions: not applicable.
For evidence-bearing changes:
Validation performed
Node v24.22.1, Linux:
npm run test:focused -- src/domain/symbolAnalysis.test.tson the base classifier — 1 failed, 22 passed (private nested enum not classified as enums)npm run test:focused -- src/domain/symbolAnalysis.test.ts— 23 passednpm run test:focused -- tests/boundary/mcp/enhancedTools.swiftTypes.test.ts— 10 passednpm run check:fast— typecheck and lint passednpm run verify:test-discovery— discovered all 3408 test files exactly onceoxfmt --checkon the two edited files — passedCompatibility, safety, and release
Author readiness
Human owner: @BeqaKs
Before merge
type(scope): outcome.Maintainer integration validation
Integrated main
6b2f9918088c02ea00efc417051362f260d1cee2, including the CI lifecycle repair. Feature diff unchanged; current heada98778dc14d1ab0037aa180c16e01b4d63f9e019. Combined validation of #10138, #10085 and #10044 on this main: 222 passed, 1 host-ELF skip across 15 parser/service/filesystem/CLI/MCP suites; typecheck and lint passed. The CI repair separately passed 373 tests with 3 host-specific skips. Local macOS Node 24.22.1; fresh hosted CI pending. No Windows loader verification is claimed.