diff --git a/gitnexus/src/core/ingestion/languages/csharp/query.ts b/gitnexus/src/core/ingestion/languages/csharp/query.ts index 9224339cf..11da2d8cd 100644 --- a/gitnexus/src/core/ingestion/languages/csharp/query.ts +++ b/gitnexus/src/core/ingestion/languages/csharp/query.ts @@ -370,6 +370,24 @@ const CSHARP_SCOPE_QUERY = ` type: (identifier) @type-binding.type name: (identifier) @type-binding.name)) @type-binding.annotation +;; Type bindings — switch-expression arms: \`obj switch { User u => …, Repo { Name: "x" } r => … }\`. +;; Distinct from the \`switch_statement\` shape above — expression-switch +;; uses \`switch_expression_arm\` nodes. +(switch_expression_arm + (declaration_pattern + type: (identifier) @type-binding.type + name: (identifier) @type-binding.name)) @type-binding.annotation + +(switch_expression_arm + (declaration_pattern + type: (generic_name) @type-binding.type + name: (identifier) @type-binding.name)) @type-binding.annotation + +(switch_expression_arm + (recursive_pattern + type: (identifier) @type-binding.type + name: (identifier) @type-binding.name)) @type-binding.annotation + ;; Type bindings — typed foreach: \`foreach (User u in xs)\`. ;; Shape parity with \`User u = …;\` — left binds to the declared type. (foreach_statement diff --git a/gitnexus/src/core/ingestion/scope-resolution/passes/receiver-bound-calls.ts b/gitnexus/src/core/ingestion/scope-resolution/passes/receiver-bound-calls.ts index 688d770d3..975d268e0 100644 --- a/gitnexus/src/core/ingestion/scope-resolution/passes/receiver-bound-calls.ts +++ b/gitnexus/src/core/ingestion/scope-resolution/passes/receiver-bound-calls.ts @@ -133,7 +133,7 @@ export function emitReceiverBoundCalls( nodeLookup, site, memberDef, - 'scope-resolution: chain-receiver', + memberDef.filePath !== parsed.filePath ? 'import-resolved' : 'global', seen, ); if (ok) { @@ -156,7 +156,7 @@ export function emitReceiverBoundCalls( nodeLookup, site, memberDef, - 'scope-resolution: namespace-receiver', + memberDef.filePath !== parsed.filePath ? 'import-resolved' : 'global', seen, ); if (ok) { @@ -183,7 +183,7 @@ export function emitReceiverBoundCalls( nodeLookup, site, memberDef, - 'scope-resolution: class-receiver', + memberDef.filePath !== parsed.filePath ? 'import-resolved' : 'global', seen, ); if (ok) { @@ -211,7 +211,7 @@ export function emitReceiverBoundCalls( nodeLookup, site, memberDef, - 'scope-resolution: dotted-typebinding', + memberDef.filePath !== parsed.filePath ? 'import-resolved' : 'global', seen, ); if (ok) { @@ -252,7 +252,7 @@ export function emitReceiverBoundCalls( nodeLookup, site, memberDef, - 'scope-resolution: chain-typebinding', + memberDef.filePath !== parsed.filePath ? 'import-resolved' : 'global', seen, ); if (ok) { @@ -281,8 +281,20 @@ export function emitReceiverBoundCalls( const reason = site.kind === 'write' || site.kind === 'read' ? site.kind - : 'scope-resolution: typeref-receiver'; - const ok = tryEmitEdge(graph, scopes, nodeLookup, site, memberDef, reason, seen); + : memberDef.filePath !== parsed.filePath + ? 'import-resolved' + : 'global'; + const confidence = site.kind === 'write' || site.kind === 'read' ? 1.0 : 0.85; + const ok = tryEmitEdge( + graph, + scopes, + nodeLookup, + site, + memberDef, + reason, + seen, + confidence, + ); if (ok) { emitted++; handledSites.add(siteKey); @@ -311,8 +323,20 @@ export function emitReceiverBoundCalls( const reason = site.kind === 'write' || site.kind === 'read' ? site.kind - : 'scope-resolution: class-receiver'; - const ok = tryEmitEdge(graph, scopes, nodeLookup, site, memberDef, reason, seen); + : memberDef.filePath !== parsed.filePath + ? 'import-resolved' + : 'global'; + const confidence = site.kind === 'write' || site.kind === 'read' ? 1.0 : 0.85; + const ok = tryEmitEdge( + graph, + scopes, + nodeLookup, + site, + memberDef, + reason, + seen, + confidence, + ); if (ok) { emitted++; handledSites.add(siteKey);