mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-13 08:51:28 +00:00
fix(type-resolution): address Phase 14 enhancement code review findings
1. Replace fragile regex in buildExportedTypeMapFromGraph with extractReturnTypeName() for consistent generic unwrapping. 2. Fix gap detection precision: check upstream.has(binding.exportedName) instead of exportedTypeMap.has(binding.sourcePath) to avoid over-counting files that import only unrelated symbols.
This commit is contained in:
parent
fff716dd92
commit
0736bb23bc
2 changed files with 5 additions and 4 deletions
|
|
@ -104,8 +104,8 @@ export function buildExportedTypeMapFromGraph(
|
|||
if (!def) return;
|
||||
const typeName = def.returnType ?? def.declaredType;
|
||||
if (!typeName || typeName.length > MAX_TYPE_NAME_LENGTH) return;
|
||||
// Extract simple type name (strip Promise<>, etc.)
|
||||
const simpleType = typeName.replace(/^(?:Promise|Observable|Task|Future|CompletableFuture)\s*<\s*/, '').replace(/\s*>\s*$/, '') || typeName;
|
||||
// Extract simple type name (strip Promise<>, etc.) — reuse shared utility
|
||||
const simpleType = extractReturnTypeName(typeName) ?? typeName;
|
||||
if (!simpleType) return;
|
||||
let fileExports = result.get(filePath);
|
||||
if (!fileExports) { fileExports = new Map(); result.set(filePath, fileExports); }
|
||||
|
|
|
|||
|
|
@ -537,8 +537,9 @@ export const runPipelineFromRepo = async (
|
|||
if (!imports) continue;
|
||||
let hasGap = false;
|
||||
for (const [, binding] of imports) {
|
||||
// E1/E2: upstream file has variable bindings in exportedTypeMap
|
||||
if (exportedTypeMap.has(binding.sourcePath)) { hasGap = true; break; }
|
||||
// E1/E2: upstream file has a matching exported binding for this specific import
|
||||
const upstream = exportedTypeMap.get(binding.sourcePath);
|
||||
if (upstream?.has(binding.exportedName)) { hasGap = true; break; }
|
||||
// E3: upstream callable has a known return type in SymbolTable
|
||||
const def = ctx.symbols.lookupExactFull(binding.sourcePath, binding.exportedName);
|
||||
if (def?.returnType) { hasGap = true; break; }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue