gitnexus 1.6.10-rc.145 → 1.6.10-rc.147

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/_shared/scope-resolution/reference-site.d.ts +37 -0
  2. package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -1
  3. package/dist/_shared/scope-resolution/types.d.ts +46 -2
  4. package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
  5. package/dist/core/ingestion/languages/cpp/adl.d.ts +2 -2
  6. package/dist/core/ingestion/languages/cpp/adl.js +67 -44
  7. package/dist/core/ingestion/languages/cpp/inline-namespaces.d.ts +28 -8
  8. package/dist/core/ingestion/languages/cpp/inline-namespaces.js +242 -68
  9. package/dist/core/ingestion/languages/cpp/interpret.d.ts +2 -0
  10. package/dist/core/ingestion/languages/cpp/interpret.js +64 -6
  11. package/dist/core/ingestion/languages/cpp/scope-resolver.js +29 -0
  12. package/dist/core/ingestion/languages/csharp/accessor-unwrap.d.ts +2 -15
  13. package/dist/core/ingestion/languages/csharp/accessor-unwrap.js +18 -10
  14. package/dist/core/ingestion/languages/csharp/scope-resolver.js +2 -2
  15. package/dist/core/ingestion/languages/go/captures.js +69 -0
  16. package/dist/core/ingestion/languages/go/interpret.d.ts +2 -0
  17. package/dist/core/ingestion/languages/go/interpret.js +16 -6
  18. package/dist/core/ingestion/languages/go/scope-resolver.js +39 -0
  19. package/dist/core/ingestion/languages/java.js +70 -0
  20. package/dist/core/ingestion/languages/kotlin/scope-resolver.js +10 -0
  21. package/dist/core/ingestion/languages/python/scope-resolver.js +11 -0
  22. package/dist/core/ingestion/languages/rust/scope-resolver.js +10 -0
  23. package/dist/core/ingestion/languages/typescript/scope-resolver.js +10 -4
  24. package/dist/core/ingestion/scope-extractor.js +48 -5
  25. package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +91 -14
  26. package/dist/core/ingestion/scope-resolution/contract/scope-resolver.js +1 -1
  27. package/dist/core/ingestion/scope-resolution/graph-bridge/edges.d.ts +12 -0
  28. package/dist/core/ingestion/scope-resolution/graph-bridge/edges.js +47 -0
  29. package/dist/core/ingestion/scope-resolution/passes/compound-receiver.d.ts +16 -6
  30. package/dist/core/ingestion/scope-resolution/passes/compound-receiver.js +124 -25
  31. package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.d.ts +53 -1
  32. package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +147 -6
  33. package/dist/core/ingestion/scope-resolution/pipeline/run.js +4 -0
  34. package/dist/core/ingestion/scope-resolution/resolution-outcome.d.ts +81 -0
  35. package/dist/core/ingestion/scope-resolution/resolution-outcome.js +38 -1
  36. package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +36 -9
  37. package/dist/core/ingestion/scope-resolution/scope/walkers.js +89 -14
  38. package/dist/core/ingestion/scope-resolution/unresolved-receivers.d.ts +36 -0
  39. package/dist/core/ingestion/scope-resolution/unresolved-receivers.js +66 -7
  40. package/dist/core/ingestion/type-extractors/shared.d.ts +17 -0
  41. package/dist/core/ingestion/type-extractors/shared.js +16 -0
  42. package/dist/core/ingestion/utils/call-analysis.d.ts +18 -0
  43. package/dist/core/ingestion/utils/call-analysis.js +126 -6
  44. package/dist/core/ingestion/utils/callable-flow-captures.d.ts +12 -0
  45. package/dist/core/ingestion/utils/callable-flow-captures.js +4 -1
  46. package/dist/core/ingestion/utils/receiver-chain-codec.d.ts +10 -3
  47. package/dist/core/ingestion/utils/receiver-chain-codec.js +52 -7
  48. package/dist/core/ingestion/workers/parse-worker.d.ts +4 -1
  49. package/dist/mcp/local/local-backend.d.ts +68 -0
  50. package/dist/mcp/local/local-backend.js +51 -12
  51. package/dist/mcp/tools.js +18 -0
  52. package/dist/storage/parse-cache.js +20 -2
  53. package/dist/storage/repo-manager.d.ts +20 -6
  54. package/dist/storage/repo-manager.js +12 -1
  55. package/package.json +1 -1
@@ -114,6 +114,30 @@ export interface ReferenceSite {
114
114
  * majority of sites — the field costs nothing where it is not needed.
115
115
  */
116
116
  readonly receiverChain?: string;
117
+ /**
118
+ * This site sits in CALLEE position: it is the expression being invoked by an
119
+ * enclosing call, not a value the program otherwise consumes. Only ever set on
120
+ * `kind: 'read'` sites, and only by languages whose member-read capture also
121
+ * matches the callee of a member call (`obj.f()` yields both a `call` site on
122
+ * `f` and a `read` site on `obj.f`).
123
+ *
124
+ * It is a POSITION FACT, not a decision. Whether that read is redundant
125
+ * depends on what the tail resolves to, which the capture layer cannot know:
126
+ *
127
+ * - tail is a METHOD → the read duplicates the call's own edge and must be
128
+ * suppressed (an `ACCESSES → m` beside a `CALLS → m`
129
+ * at the same position is a phantom).
130
+ * - tail is a FIELD → the read is GENUINE. `h.dep.Work()` where
131
+ * `Work func() error` selects a func-typed field and
132
+ * then calls the value it holds; deleting the read
133
+ * erases the only evidence that the field was used
134
+ * (callback/hook structs, hand-rolled mocks).
135
+ *
136
+ * The suppression is therefore applied at edge emission, where the resolved
137
+ * target's kind is known — see `tryEmitEdge`. Absent on every site that is not
138
+ * in callee position, so nothing changes for languages that never set it.
139
+ */
140
+ readonly inCalleePosition?: boolean;
117
141
  }
118
142
  /**
119
143
  * One step in a mixed receiver chain — the decoded form of a receiver that is
@@ -128,8 +152,21 @@ export interface ReferenceSite {
128
152
  * (`extractMixedChain`) walks a tree-sitter AST and so must stay in the
129
153
  * analyzer, but the shape it yields crosses into resolution.
130
154
  */
155
+ /**
156
+ * One hop in a receiver chain.
157
+ *
158
+ * `field` and `call` carry the member name they reach. `await` and `index` are
159
+ * NAME-FREE: the call step already holds the method name for an awaited call,
160
+ * and a subscript has no member name at all — an index expression's key is a
161
+ * value, not an identifier the resolver could look up. The codec encodes them
162
+ * as a bare sigil and rejects any trailing characters, so the encoder's
163
+ * non-empty-name guard stays live for exactly the two kinds it was written for.
164
+ */
131
165
  export type MixedChainStep = {
132
166
  kind: 'field' | 'call';
133
167
  name: string;
168
+ } | {
169
+ kind: 'await' | 'index';
170
+ name?: undefined;
134
171
  };
135
172
  //# sourceMappingURL=reference-site.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reference-site.d.ts","sourceRoot":"","sources":["../../src/scope-resolution/reference-site.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,MAAM,GACN,OAAO,GACP,gBAAgB,GAChB,UAAU,GACV,YAAY,GAWZ,WAAW,GAKX,OAAO,CAAC;AAEZ;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,aAAa,GAAG,OAAO,CAAC;AAEnE,MAAM,WAAW,aAAa;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,kCAAkC;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACtD,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAA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gB,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACtD,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C;;;;;OAKG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC7D;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED;;;;;;;;;;;;GAYG;AACH;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC"}
@@ -242,8 +242,24 @@ export type ParsedImport =
242
242
  export interface ParsedTypeBinding {
243
243
  /** The name being bound (parameter name, `self`, assignment LHS, …). */
244
244
  readonly boundName: string;
245
- /** The raw type name as written in source (`'User'`, `'models.User'`, …). */
245
+ /** The type name AFTER this provider's normalization (`'User'`,
246
+ * `'models.User'`, …) — see `TypeRef.rawName`. */
246
247
  readonly rawTypeName: string;
248
+ /**
249
+ * Optional override for `TypeRef.declaredSpelling`, for a grammar that does
250
+ * not keep the whole written type under `@type-binding.type`.
251
+ *
252
+ * The scope extractor derives the spelling from that capture by default,
253
+ * which is right for every language whose type node spans the annotation.
254
+ * C++ is the exception: `User* repos` parses with the `*` on the DECLARATOR,
255
+ * so the type capture is a bare `User` and the container-ness the index step
256
+ * needs is nowhere in the captures the extractor reads. A provider that can
257
+ * reconstruct it exactly sets it here.
258
+ *
259
+ * Leave undefined otherwise — the extractor's derivation is preferred to a
260
+ * per-language reimplementation of it.
261
+ */
262
+ readonly declaredSpelling?: string;
247
263
  readonly source: TypeRef['source'];
248
264
  }
249
265
  /**
@@ -324,8 +340,36 @@ export interface BindingRef {
324
340
  * re-exports, and nested modules. Generics deferred to V2 via `typeArgs`.
325
341
  */
326
342
  export interface TypeRef {
327
- /** The name as written in source (e.g., `'User'`, `'models.User'`, `'List'`). */
343
+ /**
344
+ * The type name AFTER the language's capture-time normalization — NOT
345
+ * necessarily what the source says. Every provider's `interpretTypeBinding`
346
+ * reduces the annotation before it gets here: TypeScript runs
347
+ * `stripGeneric` + `stripArraySuffix` to a FIXED POINT (`User[][]` → `User`),
348
+ * Go's `normalizeGoTypeName` drops `[]` and `map[K]`, C#/Python/Kotlin/Rust
349
+ * strip their single-arg collection wrappers. What survives is the name a
350
+ * class lookup can use (`'User'`, `'models.User'`, `'List'`).
351
+ *
352
+ * A consumer that needs the CONTAINER, not the element, must read
353
+ * `declaredSpelling` — see below.
354
+ */
328
355
  readonly rawName: string;
356
+ /**
357
+ * The annotation exactly as written, kept ONLY when `rawName` is not it.
358
+ *
359
+ * `rawName` alone cannot distinguish `repos: User[]` (a container the capture
360
+ * layer already reduced, so the position IS the element) from `grid: Grid`
361
+ * (an ordinary class the source happened to subscript). Both arrive as a bare
362
+ * class name that resolves. An index step reading only `rawName` therefore had
363
+ * no choice but to guess, and guessing "already reduced" typed `grid[0]` as
364
+ * `Grid` — a confidently WRONG owner for the next member.
365
+ *
366
+ * Absent when the provider's normalization was a no-op (nothing was lost, so
367
+ * `rawName` is already the written spelling), and absent for TypeRefs
368
+ * synthesized outside the capture path (a `this` receiver binding, a
369
+ * propagated return type). Consumers must treat absence as "no container
370
+ * evidence" and decline, never as "not a container".
371
+ */
372
+ readonly declaredSpelling?: string;
329
373
  /** Anchor for resolving `rawName` — the scope where the annotation/inference was written. */
330
374
  readonly declaredAtScope: ScopeId;
331
375
  readonly source: 'annotation' | 'parameter-annotation' | 'return-annotation' | 'self' | 'assignment-inferred' | 'constructor-inferred' | 'receiver-propagated';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/scope-resolution/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI/D,4FAA4F;AAC5F,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B,0DAA0D;AAC1D,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAE3B;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,WAAW,GACX,OAAO,GACP,UAAU,GACV,OAAO,GACP,YAAY,GACZ,QAAQ,CAAC;AAIb,qFAAqF;AACrF,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,OAAO;IACtB,6FAA6F;IAC7F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,gCAAgC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAI7D;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,YAAY;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,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC,QAAQ,CAAC,sBAAsB,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC5D,gEAAgE;IAChE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;gFAE4E;IAC5E,QAAQ,CAAC,gBAAgB,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACvD"}
@@ -58,8 +58,8 @@
58
58
  * - `noAdlSites` — call sites with parenthesized function (capture-time)
59
59
  * - `classToNamespaceQualifiedName` — class def → its enclosing namespace
60
60
  * qualified name (`populateCppAssociatedNamespaces` time)
61
- * - `adlIndex` / `adlIndexSource` — the lazily-built candidate index and the
62
- * `parsedFiles` reference it was built from (first-`pickCppAdlCandidates`
61
+ * - `adlIndexByPass` — the lazily-built candidate index, memoized weakly on
62
+ * the `parsedFiles` array it was built from (first-`pickCppAdlCandidates`
63
63
  * time; see `ensureAdlIndex`)
64
64
  *
65
65
  * The class→namespace map uses qualified names (not scope IDs) because
@@ -58,8 +58,8 @@
58
58
  * - `noAdlSites` — call sites with parenthesized function (capture-time)
59
59
  * - `classToNamespaceQualifiedName` — class def → its enclosing namespace
60
60
  * qualified name (`populateCppAssociatedNamespaces` time)
61
- * - `adlIndex` / `adlIndexSource` — the lazily-built candidate index and the
62
- * `parsedFiles` reference it was built from (first-`pickCppAdlCandidates`
61
+ * - `adlIndexByPass` — the lazily-built candidate index, memoized weakly on
62
+ * the `parsedFiles` array it was built from (first-`pickCppAdlCandidates`
63
63
  * time; see `ensureAdlIndex`)
64
64
  *
65
65
  * The class→namespace map uses qualified names (not scope IDs) because
@@ -103,8 +103,21 @@ function pushFileSiteKey(idx, filePath, key) {
103
103
  }
104
104
  keys.push(key);
105
105
  }
106
- let adlIndex;
107
- let adlIndexSource;
106
+ /**
107
+ * Per-pass memo: `parsedFiles` array identity → the built index. `WeakMap`-keyed
108
+ * so the entry lives only as long as the caller's `parsedFiles` array does, and
109
+ * is reclaimed with the pass — mirrors `qualifiedNsIndexByPass` in
110
+ * `inline-namespaces.ts` and `moduleScopeIndexByPass` in `file-local-linkage.ts`.
111
+ *
112
+ * Weak keying is load-bearing, not stylistic: the index holds
113
+ * `SymbolDefinition` references reaching into every ParsedFile's scopes, so the
114
+ * previous module-level strong `let` pair (index + source array) kept the whole
115
+ * C/C++ ParsedFile set alive past the point `scope-resolution/pipeline/phase.ts`
116
+ * evicts `files`/`contents`/`preExtractedByPath` and calls `forceGc()` to
117
+ * reclaim it — C++ is 7th of 16 `SCOPE_RESOLVERS` entries, so the retention
118
+ * survived nine later language passes plus emit.
119
+ */
120
+ let adlIndexByPass = new WeakMap();
108
121
  function siteKey(filePath, line, col) {
109
122
  return `${filePath}:${line}:${col}`;
110
123
  }
@@ -292,26 +305,36 @@ export function validateAdlSeqCoverage(idx) {
292
305
  return [...missing];
293
306
  }
294
307
  /** Build the ADL index on first use of a given `parsedFiles` set; reuse it for
295
- * all subsequent call sites in the same pipeline run. Reset by
308
+ * every subsequent call site in the same pipeline run. Reset by
296
309
  * `clearCppAdlState`.
297
310
  *
311
+ * Lifetime: the memoized entry is reachable only while the caller still holds
312
+ * the `parsedFiles` array. Once the pipeline drops it, the entry — and the
313
+ * `SymbolDefinition` references it holds into those files' scopes — becomes
314
+ * collectable; nothing here pins it (see {@link adlIndexByPass}).
315
+ *
298
316
  * Staleness is keyed on `parsedFiles` reference identity ONLY, but the index
299
317
  * is a function of THREE inputs: `parsedFiles` (namespace/friend candidates),
300
318
  * `scopes` (`classDefsBySimple`, read from `scopes.defs.byId`), and the
301
- * module-level `classToNamespaceQualifiedName` (friend-candidate keys). This
302
- * is sound for the current pipeline because all three are built together once
303
- * per `runScopeResolution` pass and `clearCppAdlState` runs in
304
- * `loadResolutionConfig` at the start of every pass. Callers MUST call
305
- * `clearCppAdlState` between any two passes that change `scopes` or
306
- * `classToNamespaceQualifiedName` while reusing the same `parsedFiles` array
307
- * reference — otherwise a stale index would be served. (No such caller exists
308
- * today; widening the guard to also key on `scopes` is deferred until one
309
- * does.) */
319
+ * module-level `classToNamespaceQualifiedName` (friend-candidate keys). The
320
+ * WeakMap key covers only the first, so the explicit clear is still REQUIRED
321
+ * for the other two: a later pass may hand back the same `parsedFiles`
322
+ * reference with different `scopes` / class→namespace state, and identity
323
+ * alone would serve the stale index. This is sound for the current pipeline
324
+ * because all three are built together once per `runScopeResolution` pass and
325
+ * `clearCppAdlState` runs in `loadResolutionConfig` at the start of every
326
+ * pass. Callers MUST call `clearCppAdlState` between any two passes that
327
+ * change `scopes` or `classToNamespaceQualifiedName` while reusing the same
328
+ * `parsedFiles` array reference — otherwise a stale index would be served.
329
+ * (No such caller exists today; widening the key to also cover `scopes` is
330
+ * deferred until one does.) */
310
331
  function ensureAdlIndex(scopes, parsedFiles) {
311
- if (adlIndex !== undefined && adlIndexSource === parsedFiles)
312
- return;
313
- adlIndex = buildAdlIndex(scopes, parsedFiles);
314
- adlIndexSource = parsedFiles;
332
+ let index = adlIndexByPass.get(parsedFiles);
333
+ if (index === undefined) {
334
+ index = buildAdlIndex(scopes, parsedFiles);
335
+ adlIndexByPass.set(parsedFiles, index);
336
+ }
337
+ return index;
315
338
  }
316
339
  /** Record per-call-site argument info. Called once per call site from
317
340
  * `emitCppScopeCaptures`. */
@@ -403,8 +426,14 @@ export function clearCppAdlState() {
403
426
  argInfoSiteKeysByFile.clear();
404
427
  noAdlSiteKeysByFile.clear();
405
428
  classToNamespaceQualifiedName.clear();
406
- adlIndex = undefined;
407
- adlIndexSource = undefined;
429
+ // The candidate index is dropped by REASSIGNING a fresh `WeakMap`: `WeakMap`
430
+ // has no `.clear()`, and swapping the instance discards every memoized entry
431
+ // at once — the exact invalidation the previous `adlIndex = undefined` pair
432
+ // provided. Required even though the map is keyed on `parsedFiles` identity,
433
+ // because the index also depends on `scopes` and
434
+ // `classToNamespaceQualifiedName`, which the key cannot observe (see
435
+ // {@link ensureAdlIndex}).
436
+ adlIndexByPass = new WeakMap();
408
437
  }
409
438
  /**
410
439
  * Walk `parsed.scopes` to record each Class def's enclosing namespace
@@ -467,14 +496,14 @@ export function pickCppAdlCandidates(site, callerParsed, scopes, parsedFiles) {
467
496
  if (args === undefined || args.length === 0)
468
497
  return undefined;
469
498
  // Build the workspace-wide ADL candidate index once; reuse for every site.
470
- ensureAdlIndex(scopes, parsedFiles);
499
+ const idx = ensureAdlIndex(scopes, parsedFiles);
471
500
  // Collect associated namespace QNames from every participating class-typed arg
472
501
  // and from function-reference args.
473
502
  const associatedNamespaces = new Set();
474
503
  for (const arg of args) {
475
- collectAssociatedNamespacesForAdlArg(arg, scopes, associatedNamespaces);
504
+ collectAssociatedNamespacesForAdlArg(arg, scopes, idx, associatedNamespaces);
476
505
  if (arg.functionRefText !== undefined) {
477
- collectFunctionTypeAssociatedNamespaces(arg.functionRefText, scopes, associatedNamespaces);
506
+ collectFunctionTypeAssociatedNamespaces(arg.functionRefText, scopes, idx, associatedNamespaces);
478
507
  }
479
508
  }
480
509
  if (associatedNamespaces.size === 0)
@@ -487,9 +516,6 @@ export function pickCppAdlCandidates(site, callerParsed, scopes, parsedFiles) {
487
516
  // (`friendCandidates`, ISO C++ `[basic.lookup.argdep]` §2).
488
517
  // Dedup by nodeId and sort by visitation sequence so the candidate list is
489
518
  // byte-for-byte identical to the legacy file-major scan order.
490
- const idx = adlIndex;
491
- if (idx === undefined)
492
- return undefined;
493
519
  const bySeq = new Map();
494
520
  const seenKey = new Set();
495
521
  const collectFrom = (buckets) => {
@@ -515,11 +541,11 @@ export function pickCppAdlCandidates(site, callerParsed, scopes, parsedFiles) {
515
541
  return undefined;
516
542
  return [...bySeq.entries()].sort((a, b) => a[0] - b[0]).map(([, def]) => def);
517
543
  }
518
- function collectAssociatedNamespacesForAdlArg(arg, scopes, associatedNamespaces) {
544
+ function collectAssociatedNamespacesForAdlArg(arg, scopes, idx, associatedNamespaces) {
519
545
  // For template args this may be the template name itself (e.g. `vector`);
520
546
  // simple-name lookup can match project classes with the same name (known
521
547
  // V1/V2 simplification).
522
- addAssociatedNamespaceForClassName(arg.simpleClassName, scopes, associatedNamespaces);
548
+ addAssociatedNamespaceForClassName(arg.simpleClassName, scopes, idx, associatedNamespaces);
523
549
  // Includes template-owner namespaces (e.g. `std` in std::vector<T>). If
524
550
  // that surfaces extra candidates, merged-candidate overload narrowing in
525
551
  // free-call-fallback suppresses arbitrary edge emission.
@@ -530,13 +556,13 @@ function collectAssociatedNamespacesForAdlArg(arg, scopes, associatedNamespaces)
530
556
  associatedNamespaces.add(ns);
531
557
  }
532
558
  for (const className of arg.templateArgClassNames) {
533
- addAssociatedNamespaceForClassName(className, scopes, associatedNamespaces);
559
+ addAssociatedNamespaceForClassName(className, scopes, idx, associatedNamespaces);
534
560
  }
535
561
  }
536
- function addAssociatedNamespaceForClassName(simpleClassName, scopes, associatedNamespaces) {
562
+ function addAssociatedNamespaceForClassName(simpleClassName, scopes, idx, associatedNamespaces) {
537
563
  if (simpleClassName.length === 0)
538
564
  return;
539
- const classLookup = findCppClassDefBySimpleName(simpleClassName);
565
+ const classLookup = findCppClassDefBySimpleName(idx, simpleClassName);
540
566
  if (classLookup === undefined)
541
567
  return;
542
568
  const { classDef, ambiguous } = classLookup;
@@ -629,10 +655,10 @@ function findNamespaceDefInScope(scope) {
629
655
  *
630
656
  * ISO C++ `[basic.lookup.argdep]` §2: enumerations contribute their
631
657
  * enclosing namespace to the associated set, just like class types. */
632
- function findCppClassDefBySimpleName(simpleName) {
658
+ function findCppClassDefBySimpleName(idx, simpleName) {
633
659
  // `classDefsBySimple` preserves `scopes.defs.byId` order, so `[0]` is the
634
660
  // legacy first-match and `length > 1` is the legacy `ambiguous` flag.
635
- const matches = adlIndex?.classDefsBySimple.get(simpleName);
661
+ const matches = idx.classDefsBySimple.get(simpleName);
636
662
  if (matches === undefined)
637
663
  return undefined;
638
664
  const first = matches[0];
@@ -644,10 +670,7 @@ function findCppClassDefBySimpleName(simpleName) {
644
670
  * Contribute associated namespaces for a function-reference argument by walking
645
671
  * the referenced overload set's parameter and return types.
646
672
  */
647
- function collectFunctionTypeAssociatedNamespaces(refText, scopes, out) {
648
- const idx = adlIndex;
649
- if (idx === undefined)
650
- return;
673
+ function collectFunctionTypeAssociatedNamespaces(refText, scopes, idx, out) {
651
674
  const colonIdx = refText.lastIndexOf('::');
652
675
  if (colonIdx !== -1) {
653
676
  // Qualified ref: extract namespace prefix and normalise :: → dot notation.
@@ -662,7 +685,7 @@ function collectFunctionTypeAssociatedNamespaces(refText, scopes, out) {
662
685
  const matches = idx.nsFunctionsByQName.get(nsText)?.get(simpleName);
663
686
  if (matches !== undefined) {
664
687
  for (const def of matches)
665
- collectAssociatedNamespacesForFunctionDef(def, scopes, out);
688
+ collectAssociatedNamespacesForFunctionDef(def, scopes, idx, out);
666
689
  }
667
690
  return;
668
691
  }
@@ -673,23 +696,23 @@ function collectFunctionTypeAssociatedNamespaces(refText, scopes, out) {
673
696
  const matches = idx.nsFunctionsBySimple.get(refText);
674
697
  if (matches !== undefined) {
675
698
  for (const def of matches)
676
- collectAssociatedNamespacesForFunctionDef(def, scopes, out);
699
+ collectAssociatedNamespacesForFunctionDef(def, scopes, idx, out);
677
700
  }
678
701
  }
679
- function collectAssociatedNamespacesForFunctionDef(def, scopes, out) {
702
+ function collectAssociatedNamespacesForFunctionDef(def, scopes, idx, out) {
680
703
  const parameterTypes = def.parameterTypeClasses?.map((typeClass) => typeClass.base);
681
704
  for (const paramType of parameterTypes ?? def.parameterTypes ?? []) {
682
- collectAssociatedNamespacesForFunctionTypeText(paramType, scopes, out);
705
+ collectAssociatedNamespacesForFunctionTypeText(paramType, scopes, idx, out);
683
706
  }
684
707
  if (def.returnType !== undefined) {
685
- collectAssociatedNamespacesForFunctionTypeText(def.returnType, scopes, out);
708
+ collectAssociatedNamespacesForFunctionTypeText(def.returnType, scopes, idx, out);
686
709
  }
687
710
  }
688
- function collectAssociatedNamespacesForFunctionTypeText(typeText, scopes, out) {
711
+ function collectAssociatedNamespacesForFunctionTypeText(typeText, scopes, idx, out) {
689
712
  for (const token of extractCppTypeNameTokens(typeText)) {
690
713
  if (isIgnoredCppAdlNamespace(token.namespaceName))
691
714
  continue;
692
- addAssociatedNamespaceForClassName(token.simpleName, scopes, out);
715
+ addAssociatedNamespaceForClassName(token.simpleName, scopes, idx, out);
693
716
  if (token.namespaceName !== '')
694
717
  out.add(token.namespaceName);
695
718
  }
@@ -14,12 +14,14 @@
14
14
  * 2. **Transitive qualified visibility.** `outer::foo()` resolves to
15
15
  * `outer::v1::foo()` when `v1` is inline. The qualified-namespace
16
16
  * receiver resolver (`resolveCppQualifiedNamespaceMember`) walks
17
- * inline-namespace children transitively when collecting candidates.
17
+ * inline-namespace children transitively when collecting candidates —
18
+ * once per pipeline run, into {@link QualifiedNsMemberIndex} (#2788).
18
19
  *
19
20
  * State lifecycle: capture-time `markCppInlineNamespaceRange` records each
20
21
  * inline namespace's source range; `populateCppInlineNamespaceScopes`
21
22
  * resolves ranges to `ScopeId`s during `populateOwners`. Cleared via
22
- * `clearCppInlineNamespaces`, called from `clearFileLocalNames`.
23
+ * `clearCppInlineNamespaces`, called from
24
+ * `cppScopeResolver.loadResolutionConfig` at the start of every pass.
23
25
  *
24
26
  * STL idiom this enables: `std::__1::vector` (libc++) and `std::__cxx11`
25
27
  * (libstdc++) are inline namespaces of `std`. With this support,
@@ -46,7 +48,14 @@ export declare function markCppInlineNamespaceRange(filePath: string, range: Ran
46
48
  export declare function collectCppInlineNamespaceSideChannel(filePath: string): readonly string[];
47
49
  /** Restore this file's captured inline-namespace ranges from the side-channel. */
48
50
  export declare function applyCppInlineNamespaceSideChannel(filePath: string, ranges: readonly string[]): void;
49
- /** Clear all inline-namespace state. Called from `clearFileLocalNames`. */
51
+ /** Clear all inline-namespace state. Called from
52
+ * `cppScopeResolver.loadResolutionConfig` at the start of every pass.
53
+ *
54
+ * The qualified-namespace index is dropped by REASSIGNING a fresh `WeakMap`
55
+ * (`WeakMap` has no `.clear()`) so its entries — and the `SymbolDefinition`
56
+ * references they hold — are released here rather than waiting on the key.
57
+ * Correctness does not rest on that: {@link inlineNamespaceEpoch} invalidates
58
+ * any surviving entry. */
50
59
  export declare function clearCppInlineNamespaces(): void;
51
60
  /** Resolve captured ranges to actual ScopeIds by matching scope ranges
52
61
  * against the inline-namespace ranges recorded for this file. Run from
@@ -59,17 +68,28 @@ export declare function populateCppInlineNamespaceScopes(parsed: ParsedFile): vo
59
68
  * namespace's level). */
60
69
  export declare function isCppInlineNamespaceScope(scopeId: ScopeId): boolean;
61
70
  /**
62
- * Walk every parsed file looking for a Namespace scope whose qualified
63
- * name matches `receiverName`, collect its callable ownedDefs matching
64
- * `memberName`, transitively descending into any inline-namespace
65
- * children (since they're members of the enclosing namespace under ISO
66
- * C++).
71
+ * Find the Namespace scopes whose simple name matches `receiverName` and
72
+ * return their callable members matching `memberName`, transitively
73
+ * including inline-namespace children (since they're members of the
74
+ * enclosing namespace under ISO C++). Served from a per-pipeline index
75
+ * ({@link QualifiedNsMemberIndex}), not a per-call-site workspace scan.
67
76
  *
68
77
  * Returns the most specific (innermost) match — for `outer::foo()`
69
78
  * where `inline namespace v1` declares `foo`, returns `v1::foo`. When
70
79
  * multiple inline-namespace children declare the same name, ISO C++
71
80
  * leaves the call ambiguous; returns `'ambiguous'` so the caller
72
81
  * suppresses edge emission rather than picking arbitrarily (#1564).
82
+ *
83
+ * Two production call sites, both in `scope-resolver.ts`:
84
+ * - `resolveQualifiedReceiverMember` — the `outer::foo()` qualified-receiver
85
+ * hook. Passes `callsite`, so a multi-candidate set can be narrowed by
86
+ * arity and argument types.
87
+ * - `resolveAdlCandidates` — resolving a `using ns::name;` named import back
88
+ * to its namespace member, for template-class method bodies where the
89
+ * lexical walk misses that visibility. Passes NO `callsite`, which makes
90
+ * the narrowing filters below pass-throughs: on that path any receiver
91
+ * whose member has more than one candidate returns `'ambiguous'` (and the
92
+ * caller then skips it) rather than being disambiguated.
73
93
  */
74
94
  export declare function resolveCppQualifiedNamespaceMember(receiverName: string, memberName: string, parsedFiles: readonly ParsedFile[], _scopes: ScopeResolutionIndexes, callsite?: Callsite): SymbolDefinition | 'ambiguous' | undefined;
75
95
  export {};