From ac2b6679222aae61d1ffda72b1ddab0199d7b68c Mon Sep 17 00:00:00 2001 From: Gergo Magyar Date: Tue, 21 Apr 2026 20:42:24 +0100 Subject: [PATCH] =?UTF-8?q?feat(csharp-scope):=20parity=20Unit=205e=20?= =?UTF-8?q?=E2=80=94=20namespace-prefix=20bucket=20matching?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes 2 parity failures (12 → 10). `languages/csharp/namespace-siblings.ts`: when matching accessible namespaces against class buckets, also probe every dotted prefix. `using static CrossFile.Models.UserFactory;` parses into the importer's accessible-namespace set as the full type path, but the matching bucket is keyed on the containing namespace (`CrossFile.Models`). Walking back through the dotted segments ensures the static-using importer sees the containing namespace's sibling files' return-type bindings. Legacy 175/175 green; 10 C# parity failures remain. --- .../languages/csharp/namespace-siblings.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gitnexus/src/core/ingestion/languages/csharp/namespace-siblings.ts b/gitnexus/src/core/ingestion/languages/csharp/namespace-siblings.ts index d434594fd..34cf4f7c3 100644 --- a/gitnexus/src/core/ingestion/languages/csharp/namespace-siblings.ts +++ b/gitnexus/src/core/ingestion/languages/csharp/namespace-siblings.ts @@ -160,7 +160,19 @@ export function populateCsharpNamespaceSiblings( } } - for (const nsName of accessibleNamespaces) { + // For each accessible namespace, also walk up the dotted path — + // `using static X.Y.Z;` targets a type, so the real namespace is + // `X.Y`. Both parse into `accessibleNamespaces` as-is; we probe + // the bucket map with every prefix. + const expandedNamespaces = new Set(accessibleNamespaces); + for (const ns of accessibleNamespaces) { + const segments = ns.split('.'); + for (let i = segments.length - 1; i > 0; i--) { + expandedNamespaces.add(segments.slice(0, i).join('.')); + } + } + + for (const nsName of expandedNamespaces) { const bucket = buckets.get(nsName); if (bucket === undefined) continue; for (const scopeInfo of bucket.scopes) {