Compare commits

...
Author SHA1 Message Date
Kaoru0822andClaude Opus 5.5 106f260d18 fix(swift): keep nested types with undecoded identifiers unclassified
classifySwiftSymbol stopped at the first identifier it could not decode and
kept the enclosing nominal's category. A nested type named by a punycode or
word-substituted identifier (`0...`) inside a struct was therefore filed as a
struct, so analyze_swift_types reported nested enums and classes under
structs and dropped them from a classes filter and from unclassified. Such
an identifier may name a type of any kind, so the category is now unknown.

Fixes #5553

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 15:04:37 +00:00
2 changed files with 20 additions and 1 deletions

No files matched your search

+6 -1
View File
@@ -38,7 +38,12 @@ export const classifySwiftSymbol = (
let category: SwiftTypeCategory | null = null;
for (;;) {
const end = identifierEnd(mangling, offset);
if (end === undefined) break;
if (end === undefined) {
// A word-substituted or punycode identifier (`0…`) may name a nested
// type of any kind, so the enclosing nominal no longer decides it.
if (mangling.charAt(offset) === "0") category = null;
break;
}
const kind = mangling.charAt(end);
const nominal = NOMINAL_CATEGORIES.get(kind);
if (nominal === undefined) {
+14
View File
@@ -28,6 +28,10 @@ describe("modern Swift category evidence", () => {
"$sSi4mainE7doubledSiyF",
"$s9999999999999999999999BadVMa",
"$s4main04PairVMa",
// Nested types named by punycode identifiers inside struct Envelope.
"_$s6Nested8EnvelopeV007IhuqBAbO8describeSSyF",
"_$s6Nested8EnvelopeV007jvrtDBlCAEycfC",
"_$s6Nested8EnvelopeV007jvrtDBlCMa",
];
const result = categorizeSwiftTypes(
names.map((name, index) => ({ address: String(index), name })),
@@ -52,6 +56,16 @@ describe("modern Swift category evidence", () => {
).toMatchObject({ total: 0, unclassified: [] });
});
it("keeps a nested punycode class unresolved under a class filter", () => {
const name = "_$s6Nested8EnvelopeV007jvrtDBlCMa";
expect(
categorizeSwiftTypes([{ address: "0x1", name }], { category: "classes" }),
).toMatchObject({
total: 0,
unclassified: [{ name, reason: "category_not_decoded" }],
});
});
it("deduplicates display names after selecting a category", () => {
expect(
categorizeSwiftTypes(