mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-23 22:06:04 +00:00
Merge upstream/main (65b101407) into r-language-support-rebased
Brings in upstream #3670 (import-resolver contract removal, generic indexes moved to utils/) and the other commits to 65b101407. Inside the merge, the R import code (already colocated at languages/r/import-target.ts) is ported to the new shape: resolveRImport and the provider importResolver field are deleted, imports repoint to utils/suffix-index, utils/workspace-file-index and utils/per-file-set, and the shared EXTENSIONS list from languages/import-candidates.ts is passed explicitly to the two suffixResolve calls so lookup behaviour is unchanged. No shared-core files are edited.
This commit is contained in:
commit
5eea3c7196
237 changed files with 6283 additions and 4137 deletions
2
.github/workflows/ci-tests.yml
vendored
2
.github/workflows/ci-tests.yml
vendored
|
|
@ -833,7 +833,7 @@ jobs:
|
|||
if: ${{ !cancelled() }}
|
||||
# Build-free: same baseline approach as parse-dispatch-rounds —
|
||||
# exact declared/SDK/undeclared floors plus a fingerprint, then
|
||||
# ratio timing only (resolveSwiftImportTarget, swiftPackageStrategy,
|
||||
# ratio timing only (resolveSwiftImportTarget,
|
||||
# parseSwiftPackageManifest 4n/n). Pins declaration-only resolve,
|
||||
# https:// factory survival, and #2931 segment-boundary membership.
|
||||
# See bench/swift-package-imports/measure.mjs.
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ Group-mode `trace` (`gitnexus/src/core/group/cross-trace.ts`) stitches a path th
|
|||
| Embeddings | `src/core/embeddings/` + `src/core/run-analyze.ts` |
|
||||
| Wiki generation | `src/core/wiki/` |
|
||||
| Language support | `src/core/ingestion/languages/` + `tree-sitter-queries.ts` + `gitnexus-shared/src/languages.ts` |
|
||||
| Import resolution | `src/core/ingestion/import-processor.ts` + `import-resolvers/configs/` + `model/resolution-context.ts` |
|
||||
| Import resolution | `src/core/ingestion/scope-resolution/pipeline/run.ts` + per-language `ScopeResolver.resolveImportTarget` hooks |
|
||||
| Call resolution/inheritance/MRO | `src/core/ingestion/scope-resolution/` (pipeline, passes, graph-bridge) |
|
||||
| Type extraction | `src/core/ingestion/type-extractors/` |
|
||||
| Worker pool | `src/core/ingestion/workers/` |
|
||||
|
|
@ -389,13 +389,16 @@ Single interface a language implements to plug into the pipeline. Contract fully
|
|||
| `fieldFallbackOnMethodLookup?` | Statically-typed languages turn this OFF — the heuristic over-connects (default on) |
|
||||
| `elementTypeOf?` | `(containerType, via: {kind:'index'} \| {kind:'accessor',name}) → elementType \| undefined` — element type of a container, reached by subscript (`repos[0]`) or by a property-style collection view (`data.Values`). ONE hook for both routes (it replaced the split `unwrapCollectionAccessor` / `unwrapCollectionElement`, where implementing one silently answered nothing for the other). Consulted only where the source actually performed the access — never as a general type-name normalizer |
|
||||
| `stripTypePreservingDecoration?` | `(typeName) → strippedName \| undefined` — strip ONE layer of TYPE-PRESERVING decoration (pointer, reference, `const`, nullable, borrow, sigil) so a receiver declared `*Host` still finds the `Host` binding (#2766). Never a container: unwrapping `Repo[]` here would fold `repos.find(x)` to `Repo.find` — that is `elementTypeOf`'s job, and only after a real subscript. Consulted only after every undecorated lookup fails, and only by receiver-chain base/step resolution — default off |
|
||||
| `qualifiedTypeLookupSpelling?` | `(typeRef) → 'pkg.Type' \| undefined` — the namespace-qualified spelling of a declared type whose qualifier capture cut from `rawName` (`*models.User` stored as `User`), recovered from `declaredSpelling`. Receiver typing tries it first, grounded on the qualifier's import (no unique-name guess), and falls back to the bare `rawName` lookup on any miss, so two packages' same-named types stop colliding. The binding is not rewritten — default off |
|
||||
| `qualifiedTypeLookupSpelling?` | `(typeRef, scopes?) → 'pkg.Type' \| null \| undefined` — the namespace-qualified spelling of a declared type whose qualifier capture cut from `rawName` (`*models.User` stored as `User`), recovered from `declaredSpelling`. Receiver typing tries it first, grounded on the qualifier's import (no unique-name guess). A failed written-qualified lookup stops instead of falling back to a bare type name. The optional scope indexes also let a provider expand a visible namespace alias; `null` refuses the written lookup and its fallback. The binding is not rewritten — default off |
|
||||
| `collapseMemberCallsByCallerTarget?` | One CALLS edge per (caller, target) instead of per-site — default off |
|
||||
| `populateNamespaceSiblings?` | Cross-file implicit visibility (compiler-implicit namespace sharing) — default off; ctx carries `treeCache` |
|
||||
| `hoistTypeBindingsToModule?` | Walk up to Module scope when looking up a method's return-type typeBinding — default off; enable only when bindings are stored at module level |
|
||||
| `hasFileLocalCallableLinkage?` | Precise internal-linkage predicate used only when joining callable declarations/prototypes to cross-file definitions; C/C++ use it for `static` free functions |
|
||||
| `constructorCallTargetsClass?` | A constructor-form call `Type(...)` links to the Class def rather than its explicit Constructor def — default off; Swift and Dart opt in |
|
||||
| `constructionSyntax?` | How the language spells construction, so an INLINE constructor receiver (`Service(db).m()`, `new Service(db).m()`, `Service.new.m()`) can be typed — `bare` / `keyword` / `selector`; default off, opt in per language only where measured to be needed (#2708) |
|
||||
| `resolveQualifiedCallee?` | `(calleeText, inScope, …) → callable \| undefined` — resolve a qualified callee only the language can read (`rp::make` in `x = rp::make()` / `rp::make().m()`) so chain-follow types the call from its return annotation; default off |
|
||||
| `resolveQualifiedTypeSpellings?` | A receiver's declared or return type written QUALIFIED (`rp::C x`, `f(a::Config c)`) that binds nothing through the scope chain resolves through `resolveQualifiedInheritanceBase` — qualifier matched against the candidate's namespace, refuse on a tie — instead of by its tail, which binds the nearer same-named class. Runs after every existing lookup and after the template-argument match; default off, C++ opts in |
|
||||
| `splitQualifiedCallee?` | `(callee, callerScope?, scopes?, position?) → { receiver, member } \| undefined` — map a qualified callee spelling (`rp::make`) onto a receiver/member pair that retains the full written namespace qualifier, so a factory result (`auto x = rp::make(); x.m()`, `rp::make().m()`) is typed from the definition `resolveQualifiedReceiverMember` returns and that definition's own declared return type. Caller scope, indexes and source position let a provider reject shadowed or aliased namespace qualifiers only when visible at the factory expression. Shared code never splits on a separator; default off, C++ implements it |
|
||||
|
||||
### Per-language registration
|
||||
|
||||
|
|
@ -455,7 +458,6 @@ Each language implements `LanguageProvider` (`language-provider.ts`). Key fields
|
|||
| `id`, `extensions` | Language identity and file matching |
|
||||
| `treeSitterQueries` | S-expression queries for AST extraction |
|
||||
| `importSemantics` | `named` / `wildcard-leaf` / `wildcard-transitive` / `namespace` |
|
||||
| `importResolver` | Language-specific path → file resolution |
|
||||
| `exportChecker` | Public/exported symbol detection |
|
||||
| `typeConfig` | Type annotation extraction rules |
|
||||
| `mroStrategy` | `first-wins` / `c3` / `none` |
|
||||
|
|
@ -472,22 +474,9 @@ Per-language tree-sitter queries use different AST node names but produce the **
|
|||
|
||||
### Import resolution
|
||||
|
||||
Per-language import resolution uses the **configs + factory** pattern (like call/method/class extractors). Each language declares an `ImportResolutionConfig` in `import-resolvers/configs/`, listing an ordered chain of `ImportResolverStrategy` functions. `createImportResolver()` (in `resolver-factory.ts`) composes them: first non-null result wins. Low-level helpers shared across strategies live alongside the configs in `import-resolvers/` (e.g. `go.ts`, `rust.ts`, `python.ts`).
|
||||
Per-language import resolution runs through `ScopeResolver.resolveImportTarget`, registered in `SCOPE_RESOLVERS`. The shared orchestrator (`scope-resolution/pipeline/run.ts`) passes each language's workspace configuration to the resolver hook. The hook maps a parsed import to its target file or files; finalization links imports and materializes bindings for scope lookup.
|
||||
|
||||
Unified 3-tier algorithm (`model/resolution-context.ts`), per-language `importSemantics` controls which tier activates:
|
||||
|
||||
| Tier | Confidence | Mechanism |
|
||||
| ----------------- | ---------- | ---------------------------------------------------------------------- |
|
||||
| 1 — same-file | 0.95 | Symbol table for caller's file |
|
||||
| 2 — import-scoped | 0.9 | `NamedImportMap` chains (named) or all files in `importMap` (wildcard) |
|
||||
| 3 — global | 0.5 | O(1) index lookups: class, impl, callable. Fallback only |
|
||||
|
||||
| Import strategy | Languages | Behavior |
|
||||
| --------------------- | ----------------------------------- | ---------------------------------------------- |
|
||||
| `named` | TS, JS, Java, C#, Rust, PHP, Kotlin | Only explicitly imported names visible |
|
||||
| `wildcard-leaf` | Go, Ruby, Swift, Dart | Whole-package import, no transitive re-exports |
|
||||
| `wildcard-transitive` | C, C++ | `#include` closure chains through re-exports |
|
||||
| `namespace` | Python | Module aliases resolved at call site |
|
||||
Language-specific import helpers and namespace rules live beside each resolver in `languages/<language>/`. Language-neutral package-directory and suffix indexes, workspace indexes, and per-file-set caches live in `ingestion/utils/`; suffix lookups receive their ordered extension candidates from callers. The dormant `LanguageProvider.importResolver` field, adapter, and strategy factory have been removed; new languages implement the `ScopeResolver` hook.
|
||||
|
||||
### Chunked parse-and-resolve
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -378,7 +378,7 @@
|
|||
* toward the noise floor would only buy flaky CI; see `_blind_spot` in
|
||||
* baselines.json. PR #2911 is the proof that this blind spot is real rather
|
||||
* than theoretical: JavaScript's missing index was a scan of
|
||||
* `ImportPassCache.normalizedFileList` on EVERY import, which the Set counter
|
||||
* a cached normalized file array on EVERY import, which the Set counter
|
||||
* could not see, and it took a differential parity test over 211 200 pairs plus
|
||||
* this bench's arrival to pin it.
|
||||
*
|
||||
|
|
@ -498,7 +498,7 @@ import { javaScopeResolver } from '../../src/core/ingestion/languages/java/scope
|
|||
import { cobolScopeResolver } from '../../src/core/ingestion/languages/cobol/scope-resolver.ts';
|
||||
import { resolveSwiftImportTarget } from '../../src/core/ingestion/languages/swift/import-target.ts';
|
||||
import { resolveRustImportTarget } from '../../src/core/ingestion/languages/rust/import-target.ts';
|
||||
import { resolveZigImportInternal } from '../../src/core/ingestion/import-resolvers/zig.ts';
|
||||
import { resolveZigImportInternal } from '../../src/core/ingestion/languages/zig/import-helpers.ts';
|
||||
import { resolvePythonImportTarget } from '../../src/core/ingestion/languages/python/import-target.ts';
|
||||
import { makeJsResolveImportTarget } from '../../src/core/ingestion/languages/javascript/import-target.ts';
|
||||
import { makeVueResolveImportTarget } from '../../src/core/ingestion/languages/vue/import-target.ts';
|
||||
|
|
@ -1877,7 +1877,7 @@ function buildRepo(lang, fileCount, pad = 0, shape = 'unique') {
|
|||
* `resolutionConfig` the orchestrator threads beside it.
|
||||
*
|
||||
* `allFilePaths` is a FRESH Set per pass on purpose — every per-file-set memo
|
||||
* in `import-resolvers/per-file-set.ts` is keyed on that object's identity, so
|
||||
* in `utils/per-file-set.ts` is keyed on that object's identity, so
|
||||
* reusing one Set across passes would hide the index build after the first and
|
||||
* let a rebuilt-per-import index look free from rep 2 onward.
|
||||
*
|
||||
|
|
@ -2070,8 +2070,8 @@ function resolveOne(lang, from, target, pass) {
|
|||
contextFor(pass, { kind: 'named', localName: 'X', importedName: 'X', targetRaw: target }),
|
||||
);
|
||||
}
|
||||
// Quotes already stripped — `configs/zig.ts` strips them before this call in
|
||||
// production too. `null` build config: this arm pins the path walk alone
|
||||
// Quotes are already stripped from the parsed import target.
|
||||
// `null` build config: this arm pins the path walk alone
|
||||
// (see the header); the config legs are gated by their own unit tests.
|
||||
if (lang === 'zig') return resolveZigImportInternal(from, target, allFilePaths, null);
|
||||
if (lang === 'python') {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
d51ea9edd1902fc20dd888f3fc51907c8119a4692b92c32a427801ac7f41d451
|
||||
99ec4434eb21b3212425eb92f5652e4955380ab27b705727b422b86e7e0be368
|
||||
|
|
|
|||
|
|
@ -1,5 +1,107 @@
|
|||
# Receiver-resolution baseline
|
||||
|
||||
## Rust module-qualified factory results (#3498)
|
||||
|
||||
The provider resolves module-qualified factory callees such as `rp::make`,
|
||||
`modx::make` and `crate::modx::make` before reading their own return annotations.
|
||||
Bound and inline receivers share that lookup. Untyped factory results retain
|
||||
an unresolved-receiver drop. Type-qualified construction remains separate.
|
||||
|
||||
The merged corpus contains 5,351 resolution records, compared with main
|
||||
`f6e42092`'s 5,319: 32 records added, none removed, all in Rust. The additions include the
|
||||
new factory fixture and `rust-ambiguous`'s `models::Handler.handle` receiver.
|
||||
Shape states are unchanged. The fixture's two untyped receivers add two call
|
||||
drops and two callee-read drops: calls 135 → 137, reads 27 → 29, all kinds
|
||||
182 → 186; writes remain 20. The final benchmark check verifies this baseline.
|
||||
|
||||
Qualified candidates retain Unicode names and accept uppercase module names.
|
||||
Lexical type claims distinguish type-qualified construction from module calls,
|
||||
including lowercase types and derived `Default`. A resolved type import or local
|
||||
type claim cannot fall back to a same-named module. Const generic values remain
|
||||
in Rust's value namespace. Local type aliases are not expanded by this change.
|
||||
|
||||
The merge retains main's Zig capture behavior. Filename casing cannot establish
|
||||
whether an imported file is a namespace; restoring main preserves the lowercase
|
||||
`config.zig` file-struct edge. Python root-package imports and method-return
|
||||
ownership use main's declaration checks. A cold Rust disk-scope regression and
|
||||
a repeated-member call regression cover the shared producer and drop paths.
|
||||
## Zig receiver gaps from the #3498 drop triage
|
||||
|
||||
Measured against main `2b6542737`, the four Zig fixes clear 18
|
||||
`receiver-unresolved` sites: all-kind drops move from 200 to 182, reads from
|
||||
42 to 27 and calls from 138 to 135. Writes and every shape-arm state are
|
||||
unchanged.
|
||||
|
||||
- 9 reads of `const X = @import("f.zig").X;` (zig-hub `stdx.zig:2-4`,
|
||||
zig-receivers `stdx.zig:2`, zig-idioms `holder.zig:6`, `main.zig:6`,
|
||||
`Element.zig:35`, `hub.zig:9-10`): the `@import(…)` receiver is now bound as a
|
||||
namespace, so the read resolves through the written module (`import-resolved`).
|
||||
- 3 reads off an anonymous container (`Sorter.zig:16`, `:23`, `:28`):
|
||||
the receiver names the container's minted identity. The site is now anchored
|
||||
on the member, so it moves off the reported `struct` position and resolves
|
||||
from the scope that evaluates it.
|
||||
- 1 call and its callee-position read at zig-idioms `main.zig:42`
|
||||
(`Stack(u8).init()`): the new `isTypeApplicationCall` hook types the receiver
|
||||
as `Stack`.
|
||||
- 2 calls and their callee-position reads at zig-filestruct `aliases.zig:86`
|
||||
and `:88` (`JsApi.Meta.prototype_chain` and `JsApi.value`): the
|
||||
`bridge = generic.Bridge(Local)` alias reaches `Builder` through the
|
||||
forwarding return type. These were lines 77 and 79 on the measured main.
|
||||
|
||||
Forwarding type constructors (`Bridge ↦ Builder`) also work through the
|
||||
namespace-factory lookup already merged in #3648. The combined result clears
|
||||
more sites than the original standalone branch, which cleared 14. The `b12`
|
||||
alias control resolves. Zig call drops fall from 13 to 10; `no-chain` call
|
||||
drops move from 34 to 31 and `in-program` calls from 60 to 57.
|
||||
|
||||
## C# namespace precedence after main integration
|
||||
|
||||
Types resolve through the enclosing namespace declaration's lookup tiers.
|
||||
Its own namespace and scoped using targets precede enclosing and global
|
||||
namespaces; compilation-unit usings follow. Registry candidate collection stops
|
||||
at the winning tier, retaining ambiguity within that tier. Bare class receivers
|
||||
exclude known nonzero generic arity outside the class itself. Positioned using
|
||||
ownership uses binary search over namespace starts.
|
||||
|
||||
Before the Zig merge, against main `2b6542737`, call drops move from 138 to 135, reads from 42 to 41,
|
||||
writes stay at 20, and all-kind drops move from 200 to 196. The four cleared
|
||||
sites are the two Address.Save calls in csharp-field-types and
|
||||
csharp-deep-field-chain, plus the City read and GetName call in the latter.
|
||||
All shape-arm states are unchanged. The resolution corpus has 5,313 rows versus
|
||||
5,309 on main: 40 removed records and 44 added records, all in C#.
|
||||
Process traversal is capped; these counts do not prove whole-flow coverage.
|
||||
|
||||
After merging main `f6e42092`, the baseline is 132 call drops, 26 reads,
|
||||
20 writes and 178 across all kinds. Initializing the fixture's `Voucher.Payee`
|
||||
keeps those counts and all shape states unchanged. The current corpus has
|
||||
5,324 records versus main's 5,319: 45 additions and 40 removals, all in C#.
|
||||
The initializer adds a constructor capture; only the C# capture fingerprint
|
||||
changes, and all 16 scaling ratios remain below their unchanged budgets.
|
||||
|
||||
## JS/TS literal-key writes and class-level field receivers (#3498)
|
||||
|
||||
Measured on top of #3654 (`a3db31923`, tree-identical to its squash merge
|
||||
`2b6542737`). Call drops move from 138 to 136, all-kind drops from 200 to
|
||||
178, and writes from 20 to zero. Read drops remain 42 and every shape-arm
|
||||
state is unchanged.
|
||||
|
||||
The 20 cleared writes are 19 object-literal keys answered by later resolution
|
||||
passes and the CommonJS `module.exports.arrowRequest` declaration. Answered
|
||||
sites withdraw only a matching kind/name/site drop; unanswered sites retain
|
||||
theirs. A return-shape key's own write requires its exact declaration position
|
||||
and file, so unrelated input reads and writes retain ordinary candidate ranking.
|
||||
|
||||
The two call-drop changes are `Config.DEFAULT.validate()` resolving through
|
||||
its `new Config()` initializer and the owned `this.route.go()` site in
|
||||
`ts-dynamic-this-no-seed` being classified as `receiver-owned-but-unbound`,
|
||||
which is outside this gate. The latter does not gain a call edge, and its call
|
||||
remains in the persisted unresolved-receiver summary used by impact/context.
|
||||
Static field inference stops at an untyped override and resolves constructor names through
|
||||
the value namespace; annotations retain type-namespace lookup.
|
||||
|
||||
Answered-site identity includes the full range, so an answered inner read in
|
||||
`res.data.data` cannot withdraw the unresolved outer read with the same name.
|
||||
|
||||
## Go module visibility and qualified receiver refusal
|
||||
|
||||
Local imports now select the importer's own module or a module selected by its
|
||||
|
|
@ -892,3 +994,38 @@ Two incidental corrections from that check, both to KTD6:
|
|||
drop is recorded. An untyped fixture parameter had been reporting a language
|
||||
gap that was really a fixture defect — the same error class as the untyped
|
||||
`$repo` control caught earlier.
|
||||
|
||||
|
||||
### Merged main `f6e42092`
|
||||
|
||||
Re-measured both benchmark arms after merging the Zig receiver fix from main.
|
||||
Shape states remain unchanged; counts are 132 call drops and
|
||||
178 drops of all kinds (26 reads,
|
||||
20 writes). The counts include both main and this branch's fixes.
|
||||
|
||||
Shape states remain unchanged; counts are 133 call drops and
|
||||
160 drops of all kinds (27 reads,
|
||||
0 writes). The counts include both main and this branch's fixes.
|
||||
|
||||
### Rust qualified factories after #3653
|
||||
|
||||
Main `2b4456553` is merged normally. The receiver-drop guard preserves both qualified-factory evidence and the module-export exclusion. Fresh build, both TypeScript configurations and all 28 Rust boundary, capture-golden and CommonJS checks pass. The measured baseline has 135 call drops, 164 total drops, 29 reads and 0 writes.
|
||||
### C++ qualified receivers after #3653
|
||||
|
||||
Main `2b4456553` is merged normally. The field lookup retains both the declared namespace purpose and provider-qualified type handling. Build and both TypeScript configurations pass, and all 59 focused C++ and CommonJS merge checks pass. The measured receiver baseline has 133 call drops, 160 total drops, 27 reads and 0 writes.
|
||||
### After merging #3653 into the C# namespace branch
|
||||
|
||||
Main `2b4456553` is merged normally. The measured baseline has 130 call drops and 156 across all kinds, with 26 reads and zero writes. Main has 133 calls, 27 reads and zero writes (160 total). Every shape state matches main. The fresh build and both TypeScript configurations pass, as do all 68 namespace-boundary, capture, hook and CommonJS merge checks.
|
||||
|
||||
### Rust qualified factories after #3655
|
||||
|
||||
Main `caacc3bac` is merged normally. The C# capture baseline retains main's fixture additions, and receiver counts are regenerated on the combined source: 132 call drops, 160 total, 28 reads and zero writes. All shape states match the preceding Rust baseline. Fresh build, both TypeScript configurations and 23 Rust factory, capture and CommonJS checks pass. Final hosted CI remains required.
|
||||
### C++ qualified receivers after #3655
|
||||
|
||||
Main `caacc3bac` is merged normally. The regenerated combined baseline has 130 call drops,156 total,26 reads and zero writes; all shape states match. These counts include the C# namespace fix from main. The broad C++ resolver run was interrupted for the prioritized focused merge checks and is not reported as a pass. Fresh exact-head CI remains required.
|
||||
|
||||
The prioritized merge validation passes a fresh package build, both TypeScript configurations and 56 tests across six C++, CommonJS and C# namespace-boundary files.
|
||||
|
||||
### Rust qualified factories after #3656
|
||||
|
||||
Main `a09f76be3` is merged normally. The shared receiver pass keeps Rust's provider-qualified callee hook and C++'s position-aware qualified-member lookup. Fresh package build, both TypeScript configurations and 302 tests across 20 Rust, C++, Go, CommonJS and sealed-disk-scope files pass. All 16 capture scaling checks pass without changing their budgets. The regenerated receiver check passes with 132 call drops, 160 across all kinds, 28 reads and zero writes; shape states are unchanged. The corpus adds 32 Rust resolution records to main's 5,392, removes none, and totals 5,424. Exact-head hosted CI remains required.
|
||||
|
|
|
|||
|
|
@ -199,39 +199,38 @@
|
|||
}
|
||||
},
|
||||
"countArm": {
|
||||
"callDrops": 138,
|
||||
"totalDropsAllKinds": 200,
|
||||
"callDrops": 132,
|
||||
"totalDropsAllKinds": 160,
|
||||
"bySiteKind": {
|
||||
"call": 138,
|
||||
"read": 42,
|
||||
"write": 20
|
||||
"call": 132,
|
||||
"read": 28
|
||||
},
|
||||
"callDropsByExtension": {
|
||||
".java": 49,
|
||||
".py": 24,
|
||||
".ts": 17,
|
||||
".zig": 13,
|
||||
".cs": 8,
|
||||
".ts": 16,
|
||||
".zig": 10,
|
||||
".tsx": 6,
|
||||
".rs": 6,
|
||||
".cs": 5,
|
||||
".go": 4,
|
||||
".php": 4,
|
||||
".rs": 4,
|
||||
".kt": 4,
|
||||
".js": 2,
|
||||
".dart": 2,
|
||||
".js": 1,
|
||||
".swift": 1
|
||||
},
|
||||
"callDropsByShape": {
|
||||
"chain-field": 59,
|
||||
"no-chain": 34,
|
||||
"chain-field": 54,
|
||||
"no-chain": 33,
|
||||
"chain-call": 31,
|
||||
"<<unclassified>>": 13,
|
||||
"chain-unwrap": 1
|
||||
},
|
||||
"callDropsByOrigin": {
|
||||
"in-program": 60,
|
||||
"in-program": 55,
|
||||
"external": 44,
|
||||
"unknown": 32,
|
||||
"unknown": 31,
|
||||
"<<unclassified>>": 2
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@
|
|||
"_rebaselined_callable_flow_2522_review": "PR #2522 review hardening: callable operands retain expression/qualified identity and formals retain signature metadata. Prior 3d4e32e7490c830516126e28931827949baa3594cb521f7a3d8dcfed95b6018a -> 57b3c55135af8d2af33b9a7c4bf89796a7bee5b5822b402a2dea91af7232cf4a; scaling 1.058 < 1.5.",
|
||||
"_rebaselined_callable_flow_2522_followup": "PR #2522 follow-up: provider-owned callable assignment/copy/formal/argument/invoke facts with invocation/constructor-result suppression. Prior 09ecd94911b830f52fa8807560abcbd79f163d02a2072870c1a59297e9a326e1 -> 3d4e32e7490c830516126e28931827949baa3594cb521f7a3d8dcfed95b6018a; scaling 1.039 < 1.5.",
|
||||
"_rebaselined": "#1976: F33 generic composite literal constructor inference adds generic_type captures in composite_literal patterns; fingerprint drift expected.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged \u2014 the tag is added to existing call matches, never a new match \u2014 so this is digest drift only. Prior 57b3c55135af8d2af33b9a7c4bf89796a7bee5b5822b402a2dea91af7232cf4a -> 5d6c59c2f2c0dd937c53bf5d736e0f8376b2899a381e488a33aec23524823efb.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged — the tag is added to existing call matches, never a new match — so this is digest drift only. Prior 57b3c55135af8d2af33b9a7c4bf89796a7bee5b5822b402a2dea91af7232cf4a -> 5d6c59c2f2c0dd937c53bf5d736e0f8376b2899a381e488a33aec23524823efb.",
|
||||
"_rebaselined_2766_go_pointer_receiver_fixture": "#2766: added test/fixtures/lang-resolution/go-pointer-receiver-field-chain/ (2 Go files) as the committed regression fixture for pointer-receiver base resolution. Go fixture_count 100 -> 102. Prior 5d6c59c2f2c0dd937c53bf5d736e0f8376b2899a381e488a33aec23524823efb -> 8cba537ff211fab3bac5fb4456cd1ffba14d6a2db75c40acae28ab8bf29f3d2e. FIXTURE-CORPUS GROWTH, NOT A CAPTURE CHANGE: the accompanying fix is a resolution-time lookup fallback (stripTypePreservingDecoration) and cannot move capture output; go was the ONLY language whose fingerprint drifted, and every other language matched its baseline on the same run.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|\u2026` instead of `1|\u2026`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 8cba537ff211fab3bac5fb4456cd1ffba14d6a2db75c40acae28ab8bf29f3d2e -> 8162272bb897b0b89472c406321cf8d88a5ae4ea83ea9e3c45f8e817041bff9f.",
|
||||
"_rebaselined_2766_await_subscript_emission": "#2766: extractMixedChain now walks THROUGH await and subscript nodes and peels transparent wrappers at loop entry, so sites whose receiver is `repos[0]` or `(await f())` mint a receiver chain where they previously minted none. EMISSION CHANGE: more sites carry `@reference.receiver-chain`; no existing chain changed shape. Only go and kotlin drifted of 15 \u2014 the two whose fixture corpora contain such receivers. Prior 8162272bb897b0b89472c406321cf8d88a5ae4ea83ea9e3c45f8e817041bff9f -> c9c908f441e3be12fad2448120ed3ea35dc235a12b3f63b0ec532ffdae11d9e9.",
|
||||
"_rebaselined_2766_phantom_callee_read_site": "#2766: Go's `@reference.read` pattern matches EVERY selector_expression, so a member call `h.dep.Work()` minted THREE sites \u2014 the call, the genuine `h.dep` field read, and a PHANTOM read on the callee `h.dep.Work`. The phantom resolved through findOwnedMember (which prefers methods over fields) and emitted an ACCESSES edge to the METHOD duplicating the CALLS edge at the same position; visible today on any receiver the text cascade can type (`RunFromValueReceiver -> DoWork`). The emitter now drops a read match whose selector is in FUNCTION position. FEWER capture matches for Go, no other language affected \u2014 go was the only fingerprint of 15 that moved. A method VALUE (`f := h.dep.Work`) is not in function position and is untouched. Prior c9c908f441e3be12fad2448120ed3ea35dc235a12b3f63b0ec532ffdae11d9e9 -> 7bb524a32a2eed57a15b454e3a33480e92a496c683e6856ef02179693c0e02e3.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|…` instead of `1|…`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 8cba537ff211fab3bac5fb4456cd1ffba14d6a2db75c40acae28ab8bf29f3d2e -> 8162272bb897b0b89472c406321cf8d88a5ae4ea83ea9e3c45f8e817041bff9f.",
|
||||
"_rebaselined_2766_await_subscript_emission": "#2766: extractMixedChain now walks THROUGH await and subscript nodes and peels transparent wrappers at loop entry, so sites whose receiver is `repos[0]` or `(await f())` mint a receiver chain where they previously minted none. EMISSION CHANGE: more sites carry `@reference.receiver-chain`; no existing chain changed shape. Only go and kotlin drifted of 15 — the two whose fixture corpora contain such receivers. Prior 8162272bb897b0b89472c406321cf8d88a5ae4ea83ea9e3c45f8e817041bff9f -> c9c908f441e3be12fad2448120ed3ea35dc235a12b3f63b0ec532ffdae11d9e9.",
|
||||
"_rebaselined_2766_phantom_callee_read_site": "#2766: Go's `@reference.read` pattern matches EVERY selector_expression, so a member call `h.dep.Work()` minted THREE sites — the call, the genuine `h.dep` field read, and a PHANTOM read on the callee `h.dep.Work`. The phantom resolved through findOwnedMember (which prefers methods over fields) and emitted an ACCESSES edge to the METHOD duplicating the CALLS edge at the same position; visible today on any receiver the text cascade can type (`RunFromValueReceiver -> DoWork`). The emitter now drops a read match whose selector is in FUNCTION position. FEWER capture matches for Go, no other language affected — go was the only fingerprint of 15 that moved. A method VALUE (`f := h.dep.Work`) is not in function position and is untouched. Prior c9c908f441e3be12fad2448120ed3ea35dc235a12b3f63b0ec532ffdae11d9e9 -> 7bb524a32a2eed57a15b454e3a33480e92a496c683e6856ef02179693c0e02e3.",
|
||||
"_rebaselined_2766_callee_position_marker": "#2766 review fix: a call's callee selector is no longer DROPPED at capture. An earlier commit on this branch dropped it outright, which also deleted the genuine field read on a func-typed struct field (`h.dep.Work()` where `Work func() error`) - callback/hook/mock structs lost their only ACCESSES evidence. The match is now emitted carrying `@reference.callee-position`, and the phantom is suppressed at EMIT by the resolved target's kind instead. Go only: the other 14 languages' fingerprints are byte-identical, which is the check that this is not a cross-language capture change. Prior 7bb524a32a2eed57a15b454e3a33480e92a496c683e6856ef02179693c0e02e3 -> e47302079e17a5e73711bbed5416557b49327cb67e4932008700ec6b8fb468b3; scaling 1.001 < 1.5; fixtures 102 (unchanged), capture_groups_fp 2103.",
|
||||
"_rebaselined_2813_interface_field_dispatch_fixture": "#2813: added test/fixtures/lang-resolution/go-interface-field-dispatch/ (8 Go files) as the committed regression fixture for calls through an interface-typed struct field. Go fixture_count 102 -> 110. FIXTURE-CORPUS GROWTH, NOT A CAPTURE CHANGE: the accompanying fixes are a detection-time method-set change (interface-impls.ts) and a resolution-time fan-out in the shared receiver pass, neither of which emits captures; go/query.ts and go/captures.ts are untouched. Go was the ONLY language whose fingerprint drifted, and every other language matched its baseline on the same run - the same check used for the #2766 fixture growth above. Prior e47302079e17a5e73711bbed5416557b49327cb67e4932008700ec6b8fb468b3 -> cffee41cadbf350855d99bd5aee7c015b1e8b31d1c343d02f113540abe86c765; scaling 1.074 < 1.5, capture_groups_fp 2303.",
|
||||
"_rebaselined_2837": "#2837: Go struct/interface captures re-anchored from the type_declaration onto the type_spec (@scope.class/@declaration.struct/@declaration.interface in languages/go/query.ts, @definition.struct/@definition.interface in GO_QUERIES). A grouped `type (...)` block used to yield ONE scope and ONE node for every type in it, so each type after the first lost its field typeBindings and every field-receiver call in the file emitted nothing. Capture COUNT is unchanged; only ranges moved, plus the new go-grouped-type-decl fixture. Prior c27fb803598581fa4eb7ddf5ef6f8369b9e3a150082d11362e7aa3ec8faaa832 -> e386598526e502d131e52a17d219635b3a4196d94f1ebdd25922a2582c985d18; scaling 1.054 < 1.5.",
|
||||
|
|
@ -24,11 +24,11 @@
|
|||
},
|
||||
"cobol": {
|
||||
"fingerprint": "d77fe8c2e08894d40bfdfeb6df8f5eceefa9f870bdfce9d4b620e6ef298870c9",
|
||||
"_rebaselined_2813_exact_method_sets": "#2813: Go embedded fields now emit `@reference.embedded-pointer` when spelled `*T` rather than `T`. A CAPTURE-EMISSION CHANGE, not fixture growth: fixture_count is unchanged at 110 and capture_groups_fp moves 2303 -> 2339 (+36), which is the new marker plus the WrongSigRepo/Recount rows added to two existing fixture files. The marker is required for exactness \u2014 Go gives `struct{ Base }` and `struct{ *Base }` different method sets, so structural interface satisfaction cannot be correct without knowing which was written (go.dev/ref/spec#Struct_types). Go was the ONLY language of 15 whose fingerprint moved, which is the check that this is a Go capture change and not a cross-language regression. Accompanied by SCHEMA_BUMP 39 -> 43 (skipping 40/41/42, taken by origin/main during review) so a warm cache cannot replay the pre-marker capture set. Prior cffee41cadbf350855d99bd5aee7c015b1e8b31d1c343d02f113540abe86c765 -> c27fb803598581fa4eb7ddf5ef6f8369b9e3a150082d11362e7aa3ec8faaa832; scaling 0.987 < 1.5.",
|
||||
"_rebaselined_2813_exact_method_sets": "#2813: Go embedded fields now emit `@reference.embedded-pointer` when spelled `*T` rather than `T`. A CAPTURE-EMISSION CHANGE, not fixture growth: fixture_count is unchanged at 110 and capture_groups_fp moves 2303 -> 2339 (+36), which is the new marker plus the WrongSigRepo/Recount rows added to two existing fixture files. The marker is required for exactness — Go gives `struct{ Base }` and `struct{ *Base }` different method sets, so structural interface satisfaction cannot be correct without knowing which was written (go.dev/ref/spec#Struct_types). Go was the ONLY language of 15 whose fingerprint moved, which is the check that this is a Go capture change and not a cross-language regression. Accompanied by SCHEMA_BUMP 39 -> 43 (skipping 40/41/42, taken by origin/main during review) so a warm cache cannot replay the pre-marker capture set. Prior cffee41cadbf350855d99bd5aee7c015b1e8b31d1c343d02f113540abe86c765 -> c27fb803598581fa4eb7ddf5ef6f8369b9e3a150082d11362e7aa3ec8faaa832; scaling 0.987 < 1.5.",
|
||||
"scaling_budget": 1.5,
|
||||
"_rebaselined_callable_flow_2522_followup": "PR #2522 follow-up: COBOL procedure-pointer callable flow facts; multi-topic extraction now consumes each grouped scope/declaration match once instead of requiring a duplicate declaration-only match. Prior 68ee0e95eb9f86f2d92ca35f730f4c2d4d83abc1b5241ae767ff3437780ec8d1 -> d45bb091b0893d0de4fae2486b31ba21719c9377bf35a0908fd3a36fa1c3bf4e; scaling 0.853 < 1.5.",
|
||||
"_note": "Updated for F17-F23 fixes (P2: TIMES guard, ADD GIVING, SQL AS alias). See PR #1959.",
|
||||
"_rebaselined_2793_declaratives": "PR #2793: corpus-only re-baseline. `cobol-declaratives` was added to test/fixtures/lang-resolution to reproduce the `Namespace\u2192Record` analyze abort (DECLARATIVES / USE AFTER STANDARD ERROR ON <file>), and this bench globs `lang-resolution/cobol-*`, so the corpus grew 14 -> 15 files. Verified capture-neutral: with that one fixture moved aside the fingerprint is byte-identical to the prior d45bb091b0893d0de4fae2486b31ba21719c9377bf35a0908fd3a36fa1c3bf4e. No COBOL capture code changed in that PR. Scaling 0.677 < 1.5.",
|
||||
"_rebaselined_2793_declaratives": "PR #2793: corpus-only re-baseline. `cobol-declaratives` was added to test/fixtures/lang-resolution to reproduce the `Namespace→Record` analyze abort (DECLARATIVES / USE AFTER STANDARD ERROR ON <file>), and this bench globs `lang-resolution/cobol-*`, so the corpus grew 14 -> 15 files. Verified capture-neutral: with that one fixture moved aside the fingerprint is byte-identical to the prior d45bb091b0893d0de4fae2486b31ba21719c9377bf35a0908fd3a36fa1c3bf4e. No COBOL capture code changed in that PR. Scaling 0.677 < 1.5.",
|
||||
"_rebaselined_3486_semantic_rename": "#3486: Compared actual origin/main (191a954b), committed dd3bf and frozen provider source over the same unchanged corpus. Provider semantic facts replace line-only declarations: exact name spans and qualified/binding identities, full executable ownership scopes, section namespaces, data-item properties and identifier reads/calls. The 13 changed fixture entries gain 49 property declarations, 150 reads and 11 call-reference groups; sections become 5 namespaces instead of callable functions. The fixture corpus is unchanged. Fixture entries 15; changed entries 13; capture groups 110 -> 320. Fingerprint regenerated from the runner's canonicalized capture records. Scaling budgets unchanged."
|
||||
},
|
||||
"c": {
|
||||
|
|
@ -37,17 +37,22 @@
|
|||
"_rebaselined_callable_flow_2522_review": "PR #2522 review hardening: callable operands retain expression/qualified identity and formals retain signature metadata. Prior 57fee292147ae6d2db7062da1e07d17122cf355207c8967fa85fd2ec9ca398a4 -> 3418cded9f7072152f68992f0a426f43ae7d9d553579a47075fc0cab185848a5; scaling 1.073 < 1.5.",
|
||||
"_rebaselined_callable_flow_2522_followup": "PR #2522 follow-up: C function-pointer signatures plus direct-callee argument metadata and invocation-result suppression. Prior 75bcdbbf006bf9bd263c0f5857461b118f39b164e9f821cb0651ad0ec46ef6ae -> 57fee292147ae6d2db7062da1e07d17122cf355207c8967fa85fd2ec9ca398a4; scaling 1.035 < 1.5.",
|
||||
"_rebaselined_callable_flow": "Callable-value-flow facts for C function pointers, copies, pointer-to-pointer cells, arguments, and indirect invokes. Prior 12a196b2d6249c8d86a931b12ecebc2a0cdf8d6f47683acdd0d8e9d8bc7657f5 -> 75bcdbbf006bf9bd263c0f5857461b118f39b164e9f821cb0651ad0ec46ef6ae; measured scaling ratio 0.980 < 1.5.",
|
||||
"_added": "#1956: c added to the scope-capture bench (was UNBENCHED). C has no inheritance \u2014 flat scale source. Adding it exposed + fixed a pre-existing O(n^2) findNodeAtRange root-walk in c/captures.ts (threaded c.node, byte-identical over c-* fixtures); scaling 3.475 -> 0.96.",
|
||||
"_note": "#1983: + c-static-linkage-worker fixture (caller.c/lib.c/lib.h/local.c \u2014 worker-path static-linkage side-channel test). Pure fixture-corpus drift: no c/captures.ts or query change branch-vs-main, existing fixtures' captures byte-identical (c-captures.test.ts 45/45), scaling stays linear (~0.97). The baseline was missed when the fixture landed; regenerated here. fingerprint 0de009b->39f3a83.",
|
||||
"_added": "#1956: c added to the scope-capture bench (was UNBENCHED). C has no inheritance — flat scale source. Adding it exposed + fixed a pre-existing O(n^2) findNodeAtRange root-walk in c/captures.ts (threaded c.node, byte-identical over c-* fixtures); scaling 3.475 -> 0.96.",
|
||||
"_note": "#1983: + c-static-linkage-worker fixture (caller.c/lib.c/lib.h/local.c — worker-path static-linkage side-channel test). Pure fixture-corpus drift: no c/captures.ts or query change branch-vs-main, existing fixtures' captures byte-identical (c-captures.test.ts 45/45), scaling stays linear (~0.97). The baseline was missed when the fixture landed; regenerated here. fingerprint 0de009b->39f3a83.",
|
||||
"_rebaselined": "#1919 open-language coverage: new lang-resolution fixtures + intended capture additions (F5/F9 c-cpp, F26/F28/F29 dart, F47/F48/F49/F51/F52 kotlin, F75/F79 swift). Fingerprint-only drift; scaling_ratio ~1.0 (linear, no perf regression).",
|
||||
"_rebaselined_3486_semantic_rename": "#3486: Compared actual origin/main (191a954b), committed dd3bf and frozen provider source over the same unchanged corpus. 72 pointer-parameter and 43 field type bindings are added; 19 reference-only struct/union specifiers stop introducing class scopes; 53 callable groups gain C/C++-compatible parameter type classes and normalized type spelling. The existing fixture corpus is unchanged. Fixture entries 15; changed entries 9; capture groups 545 -> 641. Fingerprint regenerated from the runner's canonicalized capture records. Scaling budgets unchanged."
|
||||
},
|
||||
"cpp": {
|
||||
"_lexical_ownership_3532": "#3532: lexical ownership captures and fixture updates; fixture identities are relative to lang-resolution so serialized scope IDs are independent of checkout location. Full capture content remains hashed; scaling_budget is unchanged.",
|
||||
"fingerprint": "dfd1de80f55d8e1bacde91a99951e7eee4e76ccdc8a7477c5a8ac98d804ce05a",
|
||||
"fingerprint": "14dcc4038c95a874f8f7bd72cbd8797f2deb030ba080b0d124ebcb3117617d00",
|
||||
"_rebaselined_qualified_receiver_typing_factory_callee": "Qualified factory callee: captures.ts now promotes `auto x = ns::f()` / `auto x = ns::T()` (a qualified_identifier callee whose innermost name is a plain identifier) from the `type: (_)` @type-binding.assignment match, which bound x to the literal type `auto`, to @type-binding.constructor with the whole qualified callee as @type-binding.type - the qualified twin of the bare `auto x = f()` rule. Template callees (`std::make_shared<T>()`) keep their dedicated rule. Compared canonicalized captures of the pre-change and post-change emitters over the same corpus: exactly ONE match changed outside the new fixture - cpp-method-enrichment/app.cpp `auto category = Animal::classify(\"dog\");`, @type-binding.assignment/type `auto` -> @type-binding.constructor/type `Animal::classify` - and none was added or removed; synthetic DAO-20 unchanged. interpret.ts additionally drops any leftover `auto` / `decltype(auto)` binding (no capture effect; over the corpus no such leftover remained). The fixture gains its qualified-factory callers (+33 groups). capture_groups_fp 4793 -> 4826, fixture_count 285 unchanged. Corpus A/B: no edge or drop outside the fixture moved (the changed binding names a class's static method, which the qualified-namespace lookup does not answer, so category stays untyped as before). Prior 2242a6b8085b27478cc8bf6f37da3f7b9b07df85fd863a3f633d7b0887ab7ac8 -> 13bfad4a8197dd9e3d252e28c6b591e08bb51e799d1c1a839f8a485d11e549eb; scaling 1.198 < 1.5.",
|
||||
"_rebaselined_qualified_receiver_typing_inline_fixture": "cpp-qualified-receiver-typing/using.cpp gains two inline-receiver callers (`make().m()` and `makeWidget().m()` under a using-directive) for the compound resolver's definition-identity return-type fallback. CORPUS GROWTH ONLY: the accompanying fix is resolution-time (compound-receiver.ts) and no emitter changed; the new fixture is the only file whose captures moved (+14 groups). capture_groups_fp 4779 -> 4793, fixture_count 285 unchanged. Prior b21abc71298d184dd484647e6d36237bb56e66c82597ef7a47452a74526856cd -> 2242a6b8085b27478cc8bf6f37da3f7b9b07df85fd863a3f633d7b0887ab7ac8; scaling 1.167 < 1.5.",
|
||||
"_rebaselined_qualified_receiver_typing_prototype_returns": "Header prototype return types: two @type-binding.return rules on a free-function PROTOTYPE (`D makeD();`, `D* makeDp();`), anchored on the `declaration` node; captures.ts drops a match whose declaration is not at namespace scope (translation unit or declaration_list, through preprocessor conditionals, extern \"C\" and template prefixes), so a block-scope `D x();` (most vexing parse) binds nothing. Compared canonicalized captures of the pre-change and post-change emitters over the same corpus: exactly ONE match added outside the new fixture - cpp-return-type/user.h `User getUser(const char* name);` (the header prototype whose same-file definition already bound the identical type) - and nothing removed or changed; synthetic DAO-20 unchanged (no free prototypes). Over the whole cpp corpus the gate drops exactly one candidate, the fixture's deliberate `E y();` in a function body. The fixture gains its prototype shapes and using.cpp (140 -> 242 groups, fixture_count 284 -> 285). capture_groups_fp 4676 -> 4779. Corpus A/B: no edge or drop outside the fixture moved. Prior a50c2b2313f34e03f8da44d34007250830b66af7c62690d55b1716219eae481e -> b21abc71298d184dd484647e6d36237bb56e66c82597ef7a47452a74526856cd; scaling 1.226 < 1.5.",
|
||||
"_rebaselined_qualified_receiver_typing_declared_ns": "Qualified declarations without an initializer: two @type-binding.annotation rules matching the OUTER qualified_identifier (`rp::C x;` and `rp::C* x = nullptr;`), the qualified twins of the bare `T x;` / `T* x = ...` rules, so the local binds `rp::C` as written for the qualifier-aware resolver. Compared canonicalized captures of the pre-change and post-change emitters over the same corpus: 29 matches ADDED outside the new fixture, every one a @type-binding.annotation on a qualified local (21 x `ns::T v;` - audit::Event, data::Pair, lib::T, alpha::Token, lib::Foo - across 16 cpp-adl-* / cpp-inline-namespace-adl-participation / cpp-phase5-u2-u3-adl-from-derived files, plus 8 std::vector / std::array / std::map locals in cpp-adl-template-args, cpp-template-cross-file and cpp-template-overload); zero matches removed or changed, no other tag moved, synthetic DAO-20 unchanged (it declares no qualified local). The new fixture gains 2 callers (127 -> 140 groups). capture_groups_fp 4634 -> 4676. Corpus A/B: no CALLS/ACCESSES edge or receiver drop outside the fixture moved (ADL arguments are typed from the capture-time AST, not typeBindings). Prior 83c1009cd6c88f6997a0b7aa8c188bc7c44c03e9126a2ed684bfb5a21bb9f5f3 -> a50c2b2313f34e03f8da44d34007250830b66af7c62690d55b1716219eae481e; scaling 1.255 < 1.5.",
|
||||
"_rebaselined_qualified_receiver_typing_brace_init": "Qualified receiver typing (resolveQualifiedTypeSpellings): the `auto x = ns::T{}` brace-init @type-binding.constructor rule now captures the WHOLE qualified_identifier instead of its type_identifier tail, so the resolver can match the qualifier (the tail bound a nearer same-named class: a global C through another include, or the enclosing namespace's own Config). Compared canonicalized captures of the pre-change and post-change emitters over the same corpus: exactly ONE existing match changed - cpp-scoped-brace-init/main.cpp `client = ns::HttpClient{}`, @type-binding.type text HttpClient -> ns::HttpClient (range 4:22-4:32 -> 4:18-4:32); no tag was added or removed anywhere. The rest is CORPUS growth: the new cpp-qualified-receiver-typing fixture (5 files, 127 capture groups). capture_groups_fp 4507 -> 4634, fixture_count 279 -> 284. The member field change (non-generic qualified members keep their qualifier) is in interpret.ts and does not touch captures. Prior dfd1de80f55d8e1bacde91a99951e7eee4e76ccdc8a7477c5a8ac98d804ce05a -> 83c1009cd6c88f6997a0b7aa8c188bc7c44c03e9126a2ed684bfb5a21bb9f5f3; scaling 1.479 < 1.5 on a host at load ~14.",
|
||||
"scaling_budget": 1.5,
|
||||
"_rebaselined_2833_qualified_member_fields": "#2833 follow-up: the six per-qualifier-depth `field_declaration` type-binding rules for a QUALIFIED generic member are replaced by three depth-agnostic ones that match the outer `qualified_identifier` itself, with the qualifier reduced to its top-level tail in `interpret.ts` (`cppQualifiedTail`). This is a CAPTURE-LOGIC change and it moves the fingerprint in two places at once. (1) A qualified NON-generic member (`ns::Address addr;`, `std::string name;`) was captured by nothing at all and now binds \u2014 that is the whole +24 on the fixture corpus, every one of them a `std::string` member. (2) Qualifier depth is no longer enumerated, so `a::b::c::Repo<User>` (depth 3+) is captured where the old rules stopped at 2. Capture-name histogram, cpp-* corpus (278 files): `@type-binding.field` 8 -> 32, `@type-binding.name` and `@type-binding.type` 401 -> 425; synthetic DAO-20: `@type-binding.field` 40 -> 60, `@type-binding.name` and `@type-binding.type` 61 -> 81 (= 20 entities x the one `std::string name;` member the DAO unit already declared). NO OTHER TAG MOVED in either set \u2014 not one `@declaration.*`, `@scope.*` or `@reference.*` count \u2014 which is the property that says three rules replaced six without widening what a field_declaration matches. Measured over the 13 cpp-* fixture repos whose sources gained a binding, the distinct CALLS edge set is byte-identical before and after (32 edges): a reduced tail that names no workspace class binds nothing. Prior bd47c82d09a83cbf0ac857f41876fa31d22304043735582e913bccde06cf2c1a -> db1156d81b3e3341faf5e938a4a34417f4fd246588b6150b4686481823262529; scaling 1.04 < 1.5.",
|
||||
"_rebaselined_2833_generic_member_fields": "#2833 review follow-up: the cpp DAO generator's unit gains two GENERIC member fields \u2014 `Repo<Entity_n> repo;` (bare template_type) and `std::vector<Entity_n> items;` (qualified_identifier wrapping a template_type) \u2014 plus the header declaring `template <typename T> class Repo`. CORPUS CHANGE, NOT A CAPTURE-LOGIC CHANGE: no extractor edit accompanies it. It exists because the corpus had ZERO template-typed member fields and, across 279 cpp-* fixtures, not one qualified generic member either, so BOTH rounds of new `field_declaration` type-binding rules landed with a byte-identical cpp fingerprint \u2014 the gate was structurally blind to the exact thing being changed. Measured under the new corpus, the three states now differ: pre-#2833 query 0e7cbda71360b7ff35dd76091c77f288d6af6a5cfa9185ad85a372aae8c85191 (4521 groups) -> the three template_type field rules de07d8b5300ed867b460918e16b4d80259c7eb6efc1034d32bebe9ff7cab126d (4541) -> the six qualified rules bd47c82d09a83cbf0ac857f41876fa31d22304043735582e913bccde06cf2c1a (4561); under the OLD corpus all three were 856d02f3f9d22cb973877211100aee8e052d4bc545922f78704b1a21ce49ddcc. Capture-name histogram over the synthetic DAO-20: `@type-binding.field` 0 -> 40, `@declaration.field` 40 -> 80, `@type-binding.type`/`@type-binding.name` 20 -> 61, `@declaration.name` 104 -> 147 \u2014 40 = 20 entities x 2 fields, with the residual +1/+2/+3 attributable to the one-off header declaration; every `@reference.*` count is unchanged. Prior 856d02f3f9d22cb973877211100aee8e052d4bc545922f78704b1a21ce49ddcc -> bd47c82d09a83cbf0ac857f41876fa31d22304043735582e913bccde06cf2c1a; scaling 1.058 < 1.5. `c` is unaffected (3418cded..., unchanged).",
|
||||
"_rebaselined_2833_qualified_member_fields": "#2833 follow-up: the six per-qualifier-depth `field_declaration` type-binding rules for a QUALIFIED generic member are replaced by three depth-agnostic ones that match the outer `qualified_identifier` itself, with the qualifier reduced to its top-level tail in `interpret.ts` (`cppQualifiedTail`). This is a CAPTURE-LOGIC change and it moves the fingerprint in two places at once. (1) A qualified NON-generic member (`ns::Address addr;`, `std::string name;`) was captured by nothing at all and now binds — that is the whole +24 on the fixture corpus, every one of them a `std::string` member. (2) Qualifier depth is no longer enumerated, so `a::b::c::Repo<User>` (depth 3+) is captured where the old rules stopped at 2. Capture-name histogram, cpp-* corpus (278 files): `@type-binding.field` 8 -> 32, `@type-binding.name` and `@type-binding.type` 401 -> 425; synthetic DAO-20: `@type-binding.field` 40 -> 60, `@type-binding.name` and `@type-binding.type` 61 -> 81 (= 20 entities x the one `std::string name;` member the DAO unit already declared). NO OTHER TAG MOVED in either set — not one `@declaration.*`, `@scope.*` or `@reference.*` count — which is the property that says three rules replaced six without widening what a field_declaration matches. Measured over the 13 cpp-* fixture repos whose sources gained a binding, the distinct CALLS edge set is byte-identical before and after (32 edges): a reduced tail that names no workspace class binds nothing. Prior bd47c82d09a83cbf0ac857f41876fa31d22304043735582e913bccde06cf2c1a -> db1156d81b3e3341faf5e938a4a34417f4fd246588b6150b4686481823262529; scaling 1.04 < 1.5.",
|
||||
"_rebaselined_2833_generic_member_fields": "#2833 review follow-up: the cpp DAO generator's unit gains two GENERIC member fields — `Repo<Entity_n> repo;` (bare template_type) and `std::vector<Entity_n> items;` (qualified_identifier wrapping a template_type) — plus the header declaring `template <typename T> class Repo`. CORPUS CHANGE, NOT A CAPTURE-LOGIC CHANGE: no extractor edit accompanies it. It exists because the corpus had ZERO template-typed member fields and, across 279 cpp-* fixtures, not one qualified generic member either, so BOTH rounds of new `field_declaration` type-binding rules landed with a byte-identical cpp fingerprint — the gate was structurally blind to the exact thing being changed. Measured under the new corpus, the three states now differ: pre-#2833 query 0e7cbda71360b7ff35dd76091c77f288d6af6a5cfa9185ad85a372aae8c85191 (4521 groups) -> the three template_type field rules de07d8b5300ed867b460918e16b4d80259c7eb6efc1034d32bebe9ff7cab126d (4541) -> the six qualified rules bd47c82d09a83cbf0ac857f41876fa31d22304043735582e913bccde06cf2c1a (4561); under the OLD corpus all three were 856d02f3f9d22cb973877211100aee8e052d4bc545922f78704b1a21ce49ddcc. Capture-name histogram over the synthetic DAO-20: `@type-binding.field` 0 -> 40, `@declaration.field` 40 -> 80, `@type-binding.type`/`@type-binding.name` 20 -> 61, `@declaration.name` 104 -> 147 — 40 = 20 entities x 2 fields, with the residual +1/+2/+3 attributable to the one-off header declaration; every `@reference.*` count is unchanged. Prior 856d02f3f9d22cb973877211100aee8e052d4bc545922f78704b1a21ce49ddcc -> bd47c82d09a83cbf0ac857f41876fa31d22304043735582e913bccde06cf2c1a; scaling 1.058 < 1.5. `c` is unaffected (3418cded..., unchanged).",
|
||||
"_rebaselined_callable_flow_2522_review": "PR #2522 review hardening: callable operands retain expression/qualified identity and formals retain signature/cv metadata. Prior dde874d2c30bda9f634f9799281a66de800cad9f76cf65e7c31839e2ae9da9ff -> 57860dd2a8d4b06c6d2dd0d854c08b781faee3da8f2b6c42ba0c68a9f70e5ccb; scaling 1.090 < 1.5.",
|
||||
"_rebaselined_callable_flow_2522_followup": "PR #2522 follow-up: C++ overload-aware function/reference/member-pointer flow facts with invocation/constructor-result suppression. Prior 3a503a1513e7eede3f7a223dcce0896c06d15bdfa920445224c9025848c0d710 -> dde874d2c30bda9f634f9799281a66de800cad9f76cf65e7c31839e2ae9da9ff; scaling 1.034 < 1.5.",
|
||||
"_rebaselined_callable_flow": "Callable-value-flow facts for C++ function pointers/references, reference aliases, contextual arity, arguments, and member-pointer syntax. Prior 6ab657c8f9bfe988a3759098c2cffdcc0443def75ff263f1282b82c21d96e931 -> 3a503a1513e7eede3f7a223dcce0896c06d15bdfa920445224c9025848c0d710; measured scaling ratio 1.069 < 1.5.",
|
||||
|
|
@ -55,56 +60,61 @@
|
|||
"_note_1899_followup": "#1899 follow-up: braced-init metadata now carries element count, intentionally changing C++ capture output; CI benchmark scaling remains linear (1.129 < 1.5).",
|
||||
"_added": "#1956: cpp added to the scope-capture bench (was UNBENCHED). Heritage-bearing scale source (: public Base, public Mixin) drives emitCppInheritanceCaptures at scale. Adding it exposed + fixed a pre-existing O(n^2) findNodeAtRange root-walk in cpp/captures.ts (~12 sites, threaded c.node, byte-identical over 263 cpp-* fixtures); scaling 2.30 -> 1.12.",
|
||||
"_rebaselined": "#1919 open-language coverage: new lang-resolution fixtures + intended capture additions (F5/F9 c-cpp, F26/F28/F29 dart, F47/F48/F49/F51/F52 kotlin, F75/F79 swift). Fingerprint-only drift; scaling_ratio ~1.0 (linear, no perf regression). #2094: deleted C++ declarations retain @declaration.is-deleted metadata; deleted operator and pointer-return shapes plus the expanded deleted-overload fixture are included. Intended capture drift; scaling remains linear (1.139 < 1.5).",
|
||||
"_note": "#1975: + cpp-out-of-line-class fixture, fixture_count 263->265. #1990: + cpp-adl-ns-plus-hidden-friend-same-name fixture (ADL hidden-friend + namespace-callable merge parity test). Pure fixture-corpus drift \u2014 no scope-extractor change; existing fixtures' captures byte-identical. fixture_count 265->267. #1995: + cpp-union-nested-tail-collision and cpp-anon-ns-tail-collision fixtures \u2014 pure fixture-corpus drift; fixture_count 270->272, fingerprint 538e8be->d63ded6. #1993: + cpp-cross-namespace-same-tail fixture \u2014 pure fixture-corpus drift; fixture_count 272->273, fingerprint d63ded6->6d6207ae. #2077 review follow-up: cpp-member-lattice adds cross-file, qualified-base, nested-template, inherited-using, this-receiver, and non-virtual-override regressions; fixture_count 274->275. Capture scaling remains linear (1.134 < 1.5). #1899: braced-init call arguments emit a conservative parameter-type capture; fixture_count 277, scaling remains linear (1.141 < 1.5).",
|
||||
"_note": "#1975: + cpp-out-of-line-class fixture, fixture_count 263->265. #1990: + cpp-adl-ns-plus-hidden-friend-same-name fixture (ADL hidden-friend + namespace-callable merge parity test). Pure fixture-corpus drift — no scope-extractor change; existing fixtures' captures byte-identical. fixture_count 265->267. #1995: + cpp-union-nested-tail-collision and cpp-anon-ns-tail-collision fixtures — pure fixture-corpus drift; fixture_count 270->272, fingerprint 538e8be->d63ded6. #1993: + cpp-cross-namespace-same-tail fixture — pure fixture-corpus drift; fixture_count 272->273, fingerprint d63ded6->6d6207ae. #2077 review follow-up: cpp-member-lattice adds cross-file, qualified-base, nested-template, inherited-using, this-receiver, and non-virtual-override regressions; fixture_count 274->275. Capture scaling remains linear (1.134 < 1.5). #1899: braced-init call arguments emit a conservative parameter-type capture; fixture_count 277, scaling remains linear (1.141 < 1.5).",
|
||||
"_rebaselined_2522_review_fixes": "PR #2522 review fixes: outermost-chain passing modes; ->* ERROR-recovery role order; member-store visibility. Prior 57860dd2a8d4b06c6d2dd0d854c08b781faee3da8f2b6c42ba0c68a9f70e5ccb -> f29bc3f7b1622954d6f6b7647bc9cf6c7a2629ffcc0fe00ac7918e4925876b65; scaling ratio re-verified within budget.",
|
||||
"_rebaselined_2522_prototype_value_cells": "Plain function/method prototypes no longer index as callable value cells (only pointer/parenthesized variable declarators do) \u2014 removes the spurious indirect-invoke facts that leaked phantom CALLS past two-phase suppression. Prior f29bc3f7b1622954d6f6b7647bc9cf6c7a2629ffcc0fe00ac7918e4925876b65 -> a70625bb0a9ef74e760d9d79cc5557485d0f0d3fb935e8a22a0c9556c65b5bb1; scaling re-verified within budget.",
|
||||
"_rebaselined_2522_prototype_value_cells": "Plain function/method prototypes no longer index as callable value cells (only pointer/parenthesized variable declarators do) — removes the spurious indirect-invoke facts that leaked phantom CALLS past two-phase suppression. Prior f29bc3f7b1622954d6f6b7647bc9cf6c7a2629ffcc0fe00ac7918e4925876b65 -> a70625bb0a9ef74e760d9d79cc5557485d0f0d3fb935e8a22a0c9556c65b5bb1; scaling re-verified within budget.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747: additionally adds the `cpp-receiver-chain-arrow` fixture, the behavioural proof for a `->` BASE receiver (`svc->getUser()->save()`) that the rollout fixed and that `cpp-chain-call/` could never catch because it uses the value `.` form. Prior a70625bb0a9ef74e760d9d79cc5557485d0f0d3fb935e8a22a0c9556c65b5bb1 -> 7e27aea46f3e17f33c41babbe0ddd982d1ab5920f143864763e0a1c6aef882a5.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|\u2026` instead of `1|\u2026`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 7e27aea46f3e17f33c41babbe0ddd982d1ab5920f143864763e0a1c6aef882a5 -> 856d02f3f9d22cb973877211100aee8e052d4bc545922f78704b1a21ce49ddcc.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|…` instead of `1|…`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 7e27aea46f3e17f33c41babbe0ddd982d1ab5920f143864763e0a1c6aef882a5 -> 856d02f3f9d22cb973877211100aee8e052d4bc545922f78704b1a21ce49ddcc.",
|
||||
"capture_groups_small": 5021,
|
||||
"capture_groups_large": 16021,
|
||||
"capture_groups_fp": 4601,
|
||||
"fixture_count": 279,
|
||||
"capture_groups_fp": 4826,
|
||||
"fixture_count": 285,
|
||||
"_rebaselined_1432_member_call_callee_name": "#1432 (Zig): the shared callable-flow reader no longer names a callee by simple name for a MEMBER call (`@callable-flow.direct-callee-name` requires a direct designator: `f(x)`, `ns.f(x)`), and a member call is a field-stored-callable invoke only when a MEMBER store (`o.f = handler`) or a declared callable-typed field is visible - a same-named plain binding no longer gates it. CAPTURE-EMISSION CHANGE, not fixture growth (fixture_count unchanged). Only drift: `choice.select(1)` / `choice.select(1.5)` (cpp-deleted-overload/main.cpp) no longer mint an INDIRECT `@callable-flow.invoke` (callee-kind binding) plus its synthetic `@reference.call.free` - that invoke was gated only by the same-named free `select` binding while the site is a genuine method call already captured as `@reference.call.member`, so the free-call duplicate is gone. capture_groups_fp 4605 -> 4601 (-4: 2 invokes + 2 synthetic call.free). Prior bf3587674267be1759e7c45abef143c3b81fe8629cfd17da5f8af40e83cc39ec -> 3aaee42523f02718795ba348782d78ec1418f35eff2e1b602422b192544fed96.",
|
||||
"_rebaselined_3486_semantic_rename": "#3486: Compared actual origin/main (191a954b), committed dd3bf and frozen provider source over the same unchanged corpus. 9 existing read matches gain receiver chains; 9 synthetic operator names now use their written operator-token range rather than the translation-unit range. Group counts are unchanged. Fixture entries 279; changed entries 10; capture groups 4507 -> 4507. Fingerprint regenerated from the runner's canonicalized capture records. Scaling budgets unchanged."
|
||||
"_rebaselined_3486_semantic_rename": "#3486: Compared actual origin/main (191a954b), committed dd3bf and frozen provider source over the same unchanged corpus. 9 existing read matches gain receiver chains; 9 synthetic operator names now use their written operator-token range rather than the translation-unit range. Group counts are unchanged. Fixture entries 279; changed entries 10; capture groups 4507 -> 4507. Fingerprint regenerated from the runner's canonicalized capture records. Scaling budgets unchanged.",
|
||||
"_rebaselined_3498_review": "Qualified callable returns retain namespace spelling. Function-template definitions publish their own parameter list, including pointer-returning declarators. Only C++ capture fingerprint changes; all sixteen unchanged scaling budgets pass. Native boundaries cover alias chains, namespace/class collisions, overloaded prototypes and independent callable return owners."
|
||||
},
|
||||
"csharp": {
|
||||
"_rebaselined": "#1956 synth-widening: + csharp-qualified-base fixture; the synth now walks record_declaration + struct_declaration base_lists and handles alias_qualified_name (matching the #1940 legacy leg), so record/struct heritage now emits. csharp-record-base gains a record inherits capture. (record->record SAME-namespace EXTENDS is a separate registry resolution gap, tracked as follow-up.) Linear (~1.00). (Earlier #1956: heritage-bearing scale source.) | #942: scope-resolution-only cleanup reworded fixture comments; capture byte-positions shift, capture LOGIC unchanged. | #1924 F16: record primary-constructor base bindings now exclude constructor arguments; capture fingerprint changes, scaling remains linear. | #2036 review follow-up: csharp-record-base now exercises primary-constructor base dispatch end to end; +2 capture groups, scaling remains linear.",
|
||||
"fingerprint": "af724813b5183ad9c98408a9c6944a44897b97d02e7f474ffa4ae637ca9ac1e3",
|
||||
"fingerprint": "28a51b97c32bf95d85e5a322e443ab00cd490a1178269c2f6f9cfc4fb9776686",
|
||||
"scaling_budget": 1.5,
|
||||
"_rebaselined_callable_flow_2522_review": "PR #2522 review hardening: callable operands retain expression/qualified identity and formals retain signature metadata. Prior f31544530924748f9aa37d11cec570bc10c3ddf9d9b237e6df7a17623fd2bb3a -> 75cf380209fa7d1a8a3ec873be1a9424b4e5173be0b08234c2291e8521a9b3c1; scaling 1.061 < 1.5.",
|
||||
"_rebaselined_callable_flow_2522_followup": "PR #2522 follow-up: C# method-group/delegate callable flow facts with invocation-result suppression. Prior 2bb5bc8c19cb8eb08c9590545ad8a1968a7152951f7e12746e2d7901d542fed9 -> f31544530924748f9aa37d11cec570bc10c3ddf9d9b237e6df7a17623fd2bb3a; scaling 1.115 < 1.5.",
|
||||
"_note": "#2046: F35 qualified-constructor captures now emit @reference.qualified-name + a simple-name @reference.name on `new Ns.Foo()`/`new A.B.Foo()`; namespace_declaration/file_scoped_namespace_declaration now emit @declaration.namespace name captures (feeding the non-destructive namespacePrefix sidecar for `new B.Foo()` same-tail disambiguation). + csharp-interface-only-base and csharp-namespace-qualified-ctor fixtures. Pure capture-additive + fixture-corpus drift; scaling stays linear (~1.11).",
|
||||
"_rebaselined_2563_instance_ownership": "#2563: csharp-using-static adds same-file ownership, local-function, overload, partial-class, and cross-namespace same-name coverage. Prior 75cf380209fa7d1a8a3ec873be1a9424b4e5173be0b08234c2291e8521a9b3c1 -> e05dc27456bde8175948586c9e7689033a378fa40e9ca4ce78cce41fbea0f2f8; scaling 1.058 < 1.5.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged \u2014 the tag is added to existing call matches, never a new match \u2014 so this is digest drift only. Prior 05a85bae70cf9c94f42459c843cfc36e3e81c872e5dcc7d77bc42fbc390f4bfe -> 8a282254b93b3ef2ff34c2fdba819ebc95c53c4fcb09942cbad99f96d3687855.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|\u2026` instead of `1|\u2026`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 8a282254b93b3ef2ff34c2fdba819ebc95c53c4fcb09942cbad99f96d3687855 -> 476d98a7cc659951c315d63319c8077bbcf0e5f3ec12d32ed773992a1f3a2adc.",
|
||||
"capture_groups_small": 4259,
|
||||
"capture_groups_large": 13609,
|
||||
"capture_groups_fp": 2657,
|
||||
"fixture_count": 178,
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged — the tag is added to existing call matches, never a new match — so this is digest drift only. Prior 05a85bae70cf9c94f42459c843cfc36e3e81c872e5dcc7d77bc42fbc390f4bfe -> 8a282254b93b3ef2ff34c2fdba819ebc95c53c4fcb09942cbad99f96d3687855.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|…` instead of `1|…`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 8a282254b93b3ef2ff34c2fdba819ebc95c53c4fcb09942cbad99f96d3687855 -> 476d98a7cc659951c315d63319c8077bbcf0e5f3ec12d32ed773992a1f3a2adc.",
|
||||
"capture_groups_small": 4509,
|
||||
"capture_groups_large": 14409,
|
||||
"capture_groups_fp": 2841,
|
||||
"fixture_count": 186,
|
||||
"_rebaselined_1432_member_call_callee_name": "#1432 (Zig): the shared callable-flow reader no longer names a callee by simple name for a MEMBER call (`@callable-flow.direct-callee-name` requires a direct designator: `f(x)`, `ns.f(x)`), and a member call is a field-stored-callable invoke only when a MEMBER store (`o.f = handler`) or a declared callable-typed field is visible - a same-named plain binding no longer gates it. CAPTURE-EMISSION CHANGE, not fixture growth (fixture_count unchanged). Only drift: `string.Join(\", \", args)` (csharp-variadic-resolution/Utils/Logger.cs) loses `direct-callee-name|Join`; the argument fact itself is unchanged, capture_groups_fp 2657 (unchanged). Prior 2930ef49fdce984a4c051409880bddfe8445e30e1c6bf802bd90a0a0f8f6b094 -> 9c4d2ca55707a03185ea45e554462e81e6d83c9f8d0ea3cd63db5c362ad1bfec.",
|
||||
"_rebaselined_3486_semantic_rename": "#3486: Compared actual origin/main (191a954b), committed dd3bf and frozen provider source over the same unchanged corpus. 89 constructor-parameter type bindings are added, 46 field declarations become addressable properties, and 3 existing member reads gain receiver-chain tags. Reversing exactly these three changes restores the complete main capture set. Fixture entries 178; changed entries 47; capture groups 2657 -> 2746. Fingerprint regenerated from the runner's canonicalized capture records. Scaling budgets unchanged."
|
||||
"_rebaselined_3486_semantic_rename": "#3486: Compared actual origin/main (191a954b), committed dd3bf and frozen provider source over the same unchanged corpus. 89 constructor-parameter type bindings are added, 46 field declarations become addressable properties, and 3 existing member reads gain receiver-chain tags. Reversing exactly these three changes restores the complete main capture set. Fixture entries 178; changed entries 47; capture groups 2657 -> 2746. Fingerprint regenerated from the runner's canonicalized capture records. Scaling budgets unchanged.",
|
||||
"_rebaselined_global_namespace_precedence": "C# global-namespace precedence: fixture growth only. The new csharp-global-namespace-precedence fixture adds 8 files and 94 capture groups; no existing entry changes (the C# capture golden gains only those 8 entries). Capture emission is unchanged. Fixture entries 178 -> 186; capture groups 2746 -> 2840. Prior af724813b5183ad9c98408a9c6944a44897b97d02e7f474ffa4ae637ca9ac1e3 -> 98b066eb5a5d6b5ece83e9fb61cff19cc7bc4b2538f7bddfcd1dc416d1ce4cb4; scaling 1.108 < 1.5.",
|
||||
"_rebaselined_3498_payee_initializer": "Review follow-up initializes Voucher.Payee in the namespace-precedence fixture. Only this fixture input changes: one constructor capture is added (2840 -> 2841 groups), fixture_count stays186; only the C# fingerprint changes. Current measured synthetic counts4509/14409, scaling1.109 below unchanged1.5; all16 languages remain within budget."
|
||||
},
|
||||
"rust": {
|
||||
"_lexical_ownership_3532": "#3532: lexical ownership captures and fixture updates; fixture identities are relative to lang-resolution so serialized scope IDs are independent of checkout location. Full capture content remains hashed; scaling_budget is unchanged.",
|
||||
"fingerprint": "7d314a184cba1e5c47260d0a5018107146437f56a2bd183ae0670f0d77a3fbd2",
|
||||
"fingerprint": "19045ed3d4ee9fcea36e949284b385f8d0a24e471cb05f77d8b35d8a1a8dd7fa",
|
||||
"scaling_budget": 1.5,
|
||||
"_rebaselined_generic_instantiation_2912": "#2912: RUST_SCOPE_QUERY tags trait-impl heritage with the instantiation the impl was written with (`impl Validator<String> for V`), so interface dispatch can prune implementors of an instantiation the receiver cannot hold. Additive capture text on existing impl matches \u2014 the same matches are minted, carrying one more field \u2014 so this is digest drift, not a capture-set change: capture_groups_fp (3556) and fixture_count (202) are both unchanged, which is the check that no match appeared or vanished. Prior 116a971fee0004f340477aff69fa110a1d92bd8ba882d7c926483c6b1e8ca2b9 -> e61653008ff2de506cfd47f905fa9eb22d82fbbfe94d2a1d8190c358211b57b7; scaling 1.018 < 1.5. Only rust and dart move; the other 13 languages are byte-identical.",
|
||||
"_rebaselined_mod_node_identity_2745_review": "#2745 review: added rust-2742-mod-members, rust-2742-nested-mods and rust-2742-type-vs-module under lang-resolution for the container/owner-edge fix, nested inline modules, and the imported-type-vs-module precedence. emitRustScopeCaptures is unchanged \u2014 verified by removing ONLY those three fixture dirs and re-running, which reproduces the prior fingerprint exactly, so the shift is purely corpus growth (fixture_count 196 -> 202, capture_groups_fp 3432 -> 3556). Prior 90fda086a4e13aa069a5981f63ed58ab1c71f1ed3da5e1480a080e1992b0d3e5 -> 05acbaca48427e0d9e0793bcd0ce4057712d3716b5e7868189c12e05ef8dd300; scaling 1.022 local / 1.057 CI < 1.5. NOTE for the next fixture author: a new rust-* fixture drifts BOTH this bench baseline and the rust-captures-golden snapshot. Updating only the golden is how this reached CI red.",
|
||||
"_rebaselined_generic_instantiation_2912": "#2912: RUST_SCOPE_QUERY tags trait-impl heritage with the instantiation the impl was written with (`impl Validator<String> for V`), so interface dispatch can prune implementors of an instantiation the receiver cannot hold. Additive capture text on existing impl matches — the same matches are minted, carrying one more field — so this is digest drift, not a capture-set change: capture_groups_fp (3556) and fixture_count (202) are both unchanged, which is the check that no match appeared or vanished. Prior 116a971fee0004f340477aff69fa110a1d92bd8ba882d7c926483c6b1e8ca2b9 -> e61653008ff2de506cfd47f905fa9eb22d82fbbfe94d2a1d8190c358211b57b7; scaling 1.018 < 1.5. Only rust and dart move; the other 13 languages are byte-identical.",
|
||||
"_rebaselined_mod_node_identity_2745_review": "#2745 review: added rust-2742-mod-members, rust-2742-nested-mods and rust-2742-type-vs-module under lang-resolution for the container/owner-edge fix, nested inline modules, and the imported-type-vs-module precedence. emitRustScopeCaptures is unchanged — verified by removing ONLY those three fixture dirs and re-running, which reproduces the prior fingerprint exactly, so the shift is purely corpus growth (fixture_count 196 -> 202, capture_groups_fp 3432 -> 3556). Prior 90fda086a4e13aa069a5981f63ed58ab1c71f1ed3da5e1480a080e1992b0d3e5 -> 05acbaca48427e0d9e0793bcd0ce4057712d3716b5e7868189c12e05ef8dd300; scaling 1.022 local / 1.057 CI < 1.5. NOTE for the next fixture author: a new rust-* fixture drifts BOTH this bench baseline and the rust-captures-golden snapshot. Updating only the golden is how this reached CI red.",
|
||||
"_rebaselined_dyn_trait_object_2604": "#2604: RUST_SCOPE_QUERY now captures function_signature_item (abstract trait methods, no body) as a scope + declaration, so a &dyn Trait receiver can dispatch a CALLS edge to the trait's own method. Additive capture shift across every bench fixture with a required trait method. Prior df369c5a5f8de7753fc8bab8b4108ef5081750974ea5085ba9a867675ac9eb29 -> f7742f65f14d7d6590df7f16303fc3cc9dc0c233cd80bf90c98b084933cd3846; scaling 1.033 < 1.5.",
|
||||
"_rebaselined_callable_flow_2522_review": "PR #2522 review hardening: callable operands retain expression/qualified identity and formals retain signature metadata. Prior 65e5bca66bb1ca117949409e8fb5c80ee69d6f1b5318908eaaecf08da0482e5c -> df369c5a5f8de7753fc8bab8b4108ef5081750974ea5085ba9a867675ac9eb29; scaling 1.065 < 1.5.",
|
||||
"_rebaselined_callable_flow_2522_followup": "PR #2522 follow-up: Rust fn-value callable flow facts with invocation/constructor-result suppression. Prior ac610bbe97666bf285923479dd7b43a2fe4c5354aae8df1bcbafdc04fb220f82 -> 65e5bca66bb1ca117949409e8fb5c80ee69d6f1b5318908eaaecf08da0482e5c; scaling 1.024 < 1.5.",
|
||||
"_rebaselined": "#1956 tri-review U1: rust-qualified-trait fixture (scoped + generic-of-scoped impl trait paths); bareTypeIdentifier now resolves scoped_type_identifier bases by their name: tail (additive, no existing-fixture drift); linear (~1.04). #1975: + rust-scoped-impl fixture (impl a::Inner / b::Inner inherent scoped impls) \u2014 legacy @definition.impl scoped arm + findEnclosingClassInfo inherent-impl scoped target; rust scope-extractor captures byte-identical. | #942: scope-resolution-only cleanup reworded fixture comments; capture byte-positions shift, capture LOGIC unchanged.",
|
||||
"_note": "PR #1934: F66/F68 let-binding pattern narrowing; F71 union (Struct-labeled, now materialized via legacy @definition.struct + resolvable); F72 macro FULLY WIRED \u2014 @declaration.macro/@reference.macro + MacroRegistry \u2192 USES edges to Macro nodes (never a same-named fn). + rust-macro / rust-union fixtures and merged with origin/main #1975 rust-scoped-impl; fingerprint re-baselined (scaling ~0.99, fixture_count 126). #1992: + rust-nested-tail-collision-generic and rust-generic-impl-same-method-name (F3) fixtures \u2014 pure fixture-corpus drift, no scope-extractor change; fixture_count 127->129, fingerprint 56ffc1c0->b00aea0f.",
|
||||
"_rebaselined": "#1956 tri-review U1: rust-qualified-trait fixture (scoped + generic-of-scoped impl trait paths); bareTypeIdentifier now resolves scoped_type_identifier bases by their name: tail (additive, no existing-fixture drift); linear (~1.04). #1975: + rust-scoped-impl fixture (impl a::Inner / b::Inner inherent scoped impls) — legacy @definition.impl scoped arm + findEnclosingClassInfo inherent-impl scoped target; rust scope-extractor captures byte-identical. | #942: scope-resolution-only cleanup reworded fixture comments; capture byte-positions shift, capture LOGIC unchanged.",
|
||||
"_note": "PR #1934: F66/F68 let-binding pattern narrowing; F71 union (Struct-labeled, now materialized via legacy @definition.struct + resolvable); F72 macro FULLY WIRED — @declaration.macro/@reference.macro + MacroRegistry → USES edges to Macro nodes (never a same-named fn). + rust-macro / rust-union fixtures and merged with origin/main #1975 rust-scoped-impl; fingerprint re-baselined (scaling ~0.99, fixture_count 126). #1992: + rust-nested-tail-collision-generic and rust-generic-impl-same-method-name (F3) fixtures — pure fixture-corpus drift, no scope-extractor change; fixture_count 127->129, fingerprint 56ffc1c0->b00aea0f.",
|
||||
"_rebaselined_import_disambiguation_2514": "#2514: added rust-import-* and rust-dup-* fixtures under lang-resolution for the range-binding ambiguity latch + import-disambiguated resolution (for-loops / struct destructuring across explicit/aliased/glob use imports). emitRustScopeCaptures is unchanged; the corpus fingerprint shifts purely because the fixture set grew (130 -> 174). Prior f7742f65f14d7d6590df7f16303fc3cc9dc0c233cd80bf90c98b084933cd3846 -> 655aed01cf1b6b84fa0c64d48dfb2526ecb67f47d90f0a91edabacd269a212db; scaling 1.06 < 1.5.",
|
||||
"_rebaselined_self_type_binding_2714": "#2714: a Rust `Self` type binding now records the enclosing impl's type instead of the literal 'Self'. `let fresh = Self { .. }` inside `impl User` binds `fresh: User`; recorded verbatim it bound `fresh: Self`, which resolves to nothing. The type-env channel already substituted this (type-extractors/rust.ts findEnclosingImplType); the scope-resolution channel did not, so the two disagreed. The gap was invisible while lookupCore Step 1 still walked the lexical chain for NAMED receivers \u2014 the impl scope binds the method by name, so fresh.validate() resolved by accident \u2014 and became a lost CALLS edge when #2714 stopped that walk. Only the rust fingerprint moves; the other 14 languages are byte-identical.",
|
||||
"_rebaselined_self_type_binding_2714": "#2714: a Rust `Self` type binding now records the enclosing impl's type instead of the literal 'Self'. `let fresh = Self { .. }` inside `impl User` binds `fresh: User`; recorded verbatim it bound `fresh: Self`, which resolves to nothing. The type-env channel already substituted this (type-extractors/rust.ts findEnclosingImplType); the scope-resolution channel did not, so the two disagreed. The gap was invisible while lookupCore Step 1 still walked the lexical chain for NAMED receivers — the impl scope binds the method by name, so fresh.validate() resolved by accident — and became a lost CALLS edge when #2714 stopped that walk. Only the rust fingerprint moves; the other 14 languages are byte-identical.",
|
||||
"_rebaselined_module_tree_2730": "#2730 + #2741 review: RUST_SCOPE_QUERY captures mod_item as @declaration.namespace (a Rust module is an item, mirroring the C++ namespace_definition capture) and tags scoped call sites with @reference.qualified-name so the written path survives to resolution. Both are additive captures: every bench fixture holding a mod block or a Foo::bar() call gains groups, and the corpus also grew by the rust-2730-* fixtures added for the fix and its review (workspace-crates, type-qualified, gaps, samename-wrapper, crate-layout). Prior 7f1240b38457468f06b7931e0c2c578f218f922774d0dc7e2ee6ef3b08d4d689 -> 90fda086a4e13aa069a5981f63ed58ab1c71f1ed3da5e1480a080e1992b0d3e5; scaling 1.061 < 1.5; fixture_count 196. Only the rust fingerprint moves; the other 14 languages are byte-identical. The earlier revision of this note cited 655aed01... as the prior value, which was two rebaselines stale (it predates #2604 and #2714); the CI gate compares live fingerprints, not this prose, so nothing caught it.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged \u2014 the tag is added to existing call matches, never a new match \u2014 so this is digest drift only. Prior 05acbaca48427e0d9e0793bcd0ce4057712d3716b5e7868189c12e05ef8dd300 -> 83812d82f0e2c3eb552f3246381ca3dd5ccd6783d63aba3325f1343e7772280c.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|\u2026` instead of `1|\u2026`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 83812d82f0e2c3eb552f3246381ca3dd5ccd6783d63aba3325f1343e7772280c -> 6174889b8c98e0af430fa54c268dc781989ca9a8172d690eebae37a95f77e809.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged — the tag is added to existing call matches, never a new match — so this is digest drift only. Prior 05acbaca48427e0d9e0793bcd0ce4057712d3716b5e7868189c12e05ef8dd300 -> 83812d82f0e2c3eb552f3246381ca3dd5ccd6783d63aba3325f1343e7772280c.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|…` instead of `1|…`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 83812d82f0e2c3eb552f3246381ca3dd5ccd6783d63aba3325f1343e7772280c -> 6174889b8c98e0af430fa54c268dc781989ca9a8172d690eebae37a95f77e809.",
|
||||
"capture_groups_small": 5507,
|
||||
"capture_groups_large": 17607,
|
||||
"capture_groups_fp": 3556,
|
||||
"fixture_count": 202,
|
||||
"_rebaselined_3486_semantic_rename": "#3486: Compared actual origin/main (191a954b), committed dd3bf and frozen provider source over the same unchanged corpus. 28 existing field-read matches gain receiver-chain tags; removing only these added tags restores the complete main capture set. No group is added or removed. Fixture entries 204; changed entries 6; capture groups 3568 -> 3568. Fingerprint regenerated from the runner's canonicalized capture records. Scaling budgets unchanged."
|
||||
"capture_groups_fp": 3699,
|
||||
"fixture_count": 207,
|
||||
"_rebaselined_3486_semantic_rename": "#3486: Compared actual origin/main (191a954b), committed dd3bf and frozen provider source over the same unchanged corpus. 28 existing field-read matches gain receiver-chain tags; removing only these added tags restores the complete main capture set. No group is added or removed. Fixture entries 204; changed entries 6; capture groups 3568 -> 3568. Fingerprint regenerated from the runner's canonicalized capture records. Scaling budgets unchanged.",
|
||||
"_rebaselined_3498_qualified_factory": "Rust module-qualified factory fixture adds four files. Provider-qualified callee and return bindings retain the complete module path. All other language fingerprints equal merged main. Measured on the combined main merge; native boundary tests cover untyped and disk-sealed calls.",
|
||||
"_rebaselined_3498_qualified_factory_review": "Review follow-up: fixture comment distinguishes module factories from type-qualified/untyped controls. Current measured Rust corpus: 207 files, 3699 capture groups, synthetic 5507/17607; fingerprint 19045ed3d4ee9fcea36e949284b385f8d0a24e471cb05f77d8b35d8a1a8dd7fa. Constructor inference retains Unicode/uppercase qualified candidates until lexical type ownership is available. Other 15 fingerprints unchanged; all 16 scaling ratios below unchanged 1.5 budgets (Rust 1.092)."
|
||||
},
|
||||
"php": {
|
||||
"fingerprint": "310d2c1cddf3b36264f988a78486f5c287a1094f8539dd165e8b58a5258febd5",
|
||||
|
|
@ -115,9 +125,9 @@
|
|||
"_rebaselined_callable_flow_2522_review": "PR #2522 review hardening: callable operands retain expression/qualified identity and formals retain signature metadata. Prior df7b1565f9115d66b1ae32e4a408d651afb2521b14e5ca615f3be426c29af618 -> 4a688fa5a7016546f7f3c6d44de023608ae80c5b0e3670c16f6e61b3632608fd; scaling 1.078 < 1.5.",
|
||||
"_rebaselined_callable_flow_2522_followup": "PR #2522 follow-up: PHP first-class callable and variable-invocation flow facts with invocation-result suppression. Prior 31c9e3f3cb7094a2bf9021cf9db859036e002f8b44605cd993b470fc600e97cb -> df7b1565f9115d66b1ae32e4a408d651afb2521b14e5ca615f3be426c29af618; scaling 1.074 < 1.5.",
|
||||
"_rebaselined": "#1956: heritage-bearing scale source (class extends Base + use trait); both forms gated at scale; linear (~1.04). | #2481/#2482: PHP imports carry a symbol-kind capture so function/constant imports resolve by declaring file; capture shape changes, scaling remains linear (~1.04).",
|
||||
"_note": "PR #1931: F53 import multi-clause, F54 enum_case, F55 anonymous_class \u2014 fixture count 138\u2192140, fingerprint drift expected.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged \u2014 the tag is added to existing call matches, never a new match \u2014 so this is digest drift only. Prior 4a688fa5a7016546f7f3c6d44de023608ae80c5b0e3670c16f6e61b3632608fd -> 3745662053c76b6ae0a84a29aad319626ed5ccb88f7b9376c2680d3dc6502e28.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|\u2026` instead of `1|\u2026`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 3745662053c76b6ae0a84a29aad319626ed5ccb88f7b9376c2680d3dc6502e28 -> b213a872342da2d866b04681dede988770e4d3dfdc0d6e9f62212ec5b59cdc2c.",
|
||||
"_note": "PR #1931: F53 import multi-clause, F54 enum_case, F55 anonymous_class — fixture count 138→140, fingerprint drift expected.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged — the tag is added to existing call matches, never a new match — so this is digest drift only. Prior 4a688fa5a7016546f7f3c6d44de023608ae80c5b0e3670c16f6e61b3632608fd -> 3745662053c76b6ae0a84a29aad319626ed5ccb88f7b9376c2680d3dc6502e28.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|…` instead of `1|…`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 3745662053c76b6ae0a84a29aad319626ed5ccb88f7b9376c2680d3dc6502e28 -> b213a872342da2d866b04681dede988770e4d3dfdc0d6e9f62212ec5b59cdc2c.",
|
||||
"_rebaselined_3486_semantic_rename": "#3486: Compared actual origin/main (191a954b), committed dd3bf and frozen provider source over the same unchanged corpus. The existing php-use-function-const/app/Config/constants.php fixture now captures its MAX_RETRIES declaration. Its one new declaration group is the entire delta. Fixture entries 143; changed entries 1; capture groups 2241 -> 2242. Fingerprint regenerated from the runner's canonicalized capture records. Scaling budgets unchanged."
|
||||
},
|
||||
"ruby": {
|
||||
|
|
@ -128,10 +138,10 @@
|
|||
"_rebaselined_callable_flow_2522_review": "PR #2522 review hardening: callable operands retain expression/qualified identity and formals retain signature metadata. Prior cff273ae6cb7232c977d9241581834a2a2fa8bcf6369f7bd8f2471cd4419a6ef -> bf50ec6a53c8c91680dc6feac63a8956e78b1059249232dc25a0cfed25f31236; scaling 1.103 < 1.5.",
|
||||
"_rebaselined_callable_flow_2522_followup": "PR #2522 follow-up: Ruby Method/Proc callable flow facts with invocation/constructor-result suppression. Prior b5ea93bb3d0469c3821a8c70f5d5991c6f326e41097c119ad691154301dcc753 -> cff273ae6cb7232c977d9241581834a2a2fa8bcf6369f7bd8f2471cd4419a6ef; scaling 1.086 < 1.5.",
|
||||
"_rebaselined": "#1956 synth-widening: + ruby-qualified-base fixture; synth now reduces a scope_resolution superclass (class C < Mod::Super) to its trailing constant (matching the #1940 legacy leg), at parity. Linear (~1.03). (Earlier #1956: heritage-bearing scale source.) | #942: scope-resolution-only cleanup reworded fixture comments; capture byte-positions shift, capture LOGIC unchanged.",
|
||||
"_note": "F62: + scope_resolution class/module declaration captures \u2014 fixture count 78\u219281, fingerprint drift expected. #1975: + ruby-tail-collision fixture (Foo::Bar vs Baz::Bar stay distinct nodes) \u2014 pure fixture-corpus drift, scope-extractor captures unchanged; 81\u219282. #1991: + ruby-nested-mixin-tail-collision fixture (85\u219286). Recomputed on the #942 merge (fixture-comment rewording shifts capture byte-positions, capture LOGIC unchanged): bf6b13a -> b5ea93bb.",
|
||||
"_note": "F62: + scope_resolution class/module declaration captures — fixture count 78→81, fingerprint drift expected. #1975: + ruby-tail-collision fixture (Foo::Bar vs Baz::Bar stay distinct nodes) — pure fixture-corpus drift, scope-extractor captures unchanged; 81→82. #1991: + ruby-nested-mixin-tail-collision fixture (85→86). Recomputed on the #942 merge (fixture-comment rewording shifts capture byte-positions, capture LOGIC unchanged): bf6b13a -> b5ea93bb.",
|
||||
"_rebaselined_2522_review_fixes": "PR #2522 review fixes: bare identifiers are calls, not callable references (bareNamesAreCalls). Prior bf50ec6a53c8c91680dc6feac63a8956e78b1059249232dc25a0cfed25f31236 -> 070e4e11502442998ddf4048c2981cf1b2b735a87362ff854c5d14d71f98f4e2; scaling ratio re-verified within budget.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged \u2014 the tag is added to existing call matches, never a new match \u2014 so this is digest drift only. Prior fea3edf82f521995147874b7f6c5f9e2eb88efdebf6365668f3260e913f0b558 -> fc81941b0a921074fa80dc448284de9a23bd07358ddc84d4894797cc08c3fe83.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|\u2026` instead of `1|\u2026`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior fc81941b0a921074fa80dc448284de9a23bd07358ddc84d4894797cc08c3fe83 -> 1c8c9c4b54036fa24c2a81e39ea530e938645c856d369075e5f437da78218c57.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged — the tag is added to existing call matches, never a new match — so this is digest drift only. Prior fea3edf82f521995147874b7f6c5f9e2eb88efdebf6365668f3260e913f0b558 -> fc81941b0a921074fa80dc448284de9a23bd07358ddc84d4894797cc08c3fe83.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|…` instead of `1|…`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior fc81941b0a921074fa80dc448284de9a23bd07358ddc84d4894797cc08c3fe83 -> 1c8c9c4b54036fa24c2a81e39ea530e938645c856d369075e5f437da78218c57.",
|
||||
"_rebaselined_3354_callable_alternatives": "#3354 callable alternatives: a callable chosen by a value-selecting source now flows every branch it can yield (`a ?? b`, `a || b`, `a or b`, `c ? a : b`, statement `if`, elvis), and an operator branch (`x == f || g`) stays opaque instead of seeding a qualified name. Verified by running the BASE (merge-base 233ca2849) and HEAD emitters over the SAME HEAD fixture corpus: every added or removed match is an `@callable-flow.*` match on one of those sources, and the pre-existing corpus is byte-identical (all other languages: zero delta). The rest of the drift is corpus growth from this PR's regression fixture, which this bench globs. Corpus growth: ruby-callable-alternatives/app.rb (+1 file, +58 groups). Emitter delta: +5 / -0: seeds for single-statement `if` / `elsif` branches (run_then, run_else, run_sweep, run_a, run_b); the multi-statement branch contributes nothing. capture_groups_fp 1358 -> 1416, fixture_count 91 -> 92; synthetic counts unchanged; scaling 1.04 < 1.5. Prior 1c8c9c4b54036fa24c2a81e39ea530e938645c856d369075e5f437da78218c57 -> 45e65d9fa8a9e5e905ddb596b179b77c86ed13ab5139c6b17ccaaf7315dfe46a.",
|
||||
"capture_groups_small": 3011,
|
||||
"capture_groups_large": 9611,
|
||||
|
|
@ -151,8 +161,8 @@
|
|||
"_rebaselined_callable_flow_2522_followup": "PR #2522 follow-up: Swift function-value callable flow facts with invocation-result suppression. Prior 180ac68e780bdf6f9089d53f51cbb9a66aed3e7774631cc3fcbaae5020213998 -> 5f923c6604d825d12b249f31c155b0f4d13a8379d532e5dde64a0f9b15cf4725; scaling 1.043 < 1.5.",
|
||||
"_rebaselined": "#1919 open-language coverage: new lang-resolution fixtures + intended capture additions (F5/F9 c-cpp, F26/F28/F29 dart, F47/F48/F49/F51/F52 kotlin, F75/F79 swift). Fingerprint-only drift; scaling_ratio ~1.0 (linear, no perf regression).",
|
||||
"_rebaselined_2522_review_fixes": "PR #2522 review fixes: assignment target:/result: fields join the shared fallback. Prior 7687ee2466e16020a12440a03fbda53e63aa05f94b4481f6133c09867a0d560d -> 115c5da807e36bb12fdeba28e44f2b6484ef322ff26c19fa0f191febaf774248; scaling ratio re-verified within budget.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged \u2014 the tag is added to existing call matches, never a new match \u2014 so this is digest drift only. Prior 115c5da807e36bb12fdeba28e44f2b6484ef322ff26c19fa0f191febaf774248 -> a6fca5f052ae5ec635b56051e28a168c864a988b2221a3279ddd69807378ba0b.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|\u2026` instead of `1|\u2026`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior a6fca5f052ae5ec635b56051e28a168c864a988b2221a3279ddd69807378ba0b -> 2f04ae960123cf50138a49fabdc5a146c2963170cecf5755c552b23c9055a9e7.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged — the tag is added to existing call matches, never a new match — so this is digest drift only. Prior 115c5da807e36bb12fdeba28e44f2b6484ef322ff26c19fa0f191febaf774248 -> a6fca5f052ae5ec635b56051e28a168c864a988b2221a3279ddd69807378ba0b.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|…` instead of `1|…`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior a6fca5f052ae5ec635b56051e28a168c864a988b2221a3279ddd69807378ba0b -> 2f04ae960123cf50138a49fabdc5a146c2963170cecf5755c552b23c9055a9e7.",
|
||||
"_rebaselined_inferred_field_receiver_2807": "#2807: optional property annotations (`var a: Outer?`) now emit a type binding. The prior pattern required the `user_type` to be a DIRECT child of the annotation, so an `optional_type` wrapper meant an optional field was never typed at all and its receiver could not resolve. ADDS @type-binding.annotation captures on the optional form only; no capture is removed. Prior 2f04ae960123cf50138a49fabdc5a146c2963170cecf5755c552b23c9055a9e7 -> adef9284feaecd39cb490aebce83876e15b9150c7a04b00a396feb78b7e1e0a9; scaling 1.023 < 1.5.",
|
||||
"_rebaselined_nested_constructor_3262": "#3262: the existing nested-constructor fixture now uses the qualified legal form `extension Outer.Container`, covering full extension-owner recovery. Fixture-only capture drift; no capture logic changed. Prior adef9284feaecd39cb490aebce83876e15b9150c7a04b00a396feb78b7e1e0a9 -> 3ac80b64776969effb75c8d32aa0bc38fc6a41c6c115a33829c502559fa404f9; scaling 1.025 < 1.5.",
|
||||
"_rebaselined_3309_call_result_assignment": "#3309: the Swift protocol-extension regression fixture adds one file with an untyped local initialized from a helper call, plus a compound-field receiver call. The capture query is unchanged; this is fixture-corpus growth only. capture_groups_fp 1235 -> 1272 and fixture_count 62 -> 64; synthetic scale counts remain 5012/16012. Prior adef9284feaecd39cb490aebce83876e15b9150c7a04b00a396feb78b7e1e0a9 -> 4d32535d454cd79086f0fcaec3b75de855c1314e73630321460e569f19aa484f; measured scaling 1.020 < 1.5.",
|
||||
|
|
@ -166,7 +176,7 @@
|
|||
"fingerprint": "1c5b892a136318eddee3435225284896c2effb52dd51ca5717c92887ae4a39a3",
|
||||
"scaling_budget": 1.5,
|
||||
"_rebaselined_2963_package_imports": "#3369 package-import fixtures: dart-package-imports adds six .dart files. CORPUS GROWTH ONLY, NOT A CAPTURE CHANGE: parking that directory restores 795290a9524ee0dc38af635536e9744c401ec13828ec77822d39e59e1cd6e649 byte-for-byte. The six files contribute 33 capture groups (862 -> 895) and fixture_count 37 -> 43. Synthetic scale counts stay 5011/16011. Local scaling 1.091 < 1.5. Prior 795290a9524ee0dc38af635536e9744c401ec13828ec77822d39e59e1cd6e649 -> f4edcfedb6e97def5ffbb9d3227fce2549e5c6c6cc876a05bc3b68a46ed30c24.",
|
||||
"_rebaselined_generic_instantiation_2912": "#2912: the Dart heritage marker carries a fourth field \u2014 the type arguments the clause was written with (`implements Validator<String>`) \u2014 so interface dispatch can prune implementors of a mismatched instantiation. Additive marker text on existing heritage matches rather than a new match, so this is digest drift only; a marker from a pre-#2912 cache simply has no fourth field and reads as unknown. Prior ba93c90dcd341259e8e088816bc8c76ad27882419f665e35c056dc22fa54cf73 -> 3a8ddabbeb1cba47a4757451d4f79d726ca230fd15e860772b11526fbb1c6687; scaling 1.027 < 1.5.",
|
||||
"_rebaselined_generic_instantiation_2912": "#2912: the Dart heritage marker carries a fourth field — the type arguments the clause was written with (`implements Validator<String>`) — so interface dispatch can prune implementors of a mismatched instantiation. Additive marker text on existing heritage matches rather than a new match, so this is digest drift only; a marker from a pre-#2912 cache simply has no fourth field and reads as unknown. Prior ba93c90dcd341259e8e088816bc8c76ad27882419f665e35c056dc22fa54cf73 -> 3a8ddabbeb1cba47a4757451d4f79d726ca230fd15e860772b11526fbb1c6687; scaling 1.027 < 1.5.",
|
||||
"_rebaselined_2538": "#2538: Dart extension type headers are preprocessed into normal extension declarations before scope capture, so extension type symbols and their methods are now emitted. Intentional Dart-only capture fingerprint drift; CI measured scaling 1.042 < 1.5.",
|
||||
"_rebaselined_2538_implements": "#2538 tri-review follow-up: Dart extension type implements clauses now emit heritage markers and fixture coverage asserts IMPLEMENTS edges, including multi-arg generic interfaces. Prior committed baseline 66a46d5ff09f3d11b2771db0f48596fe7057e95c5bc8f56241fdb911137298c3 -> ba93c90dcd341259e8e088816bc8c76ad27882419f665e35c056dc22fa54cf73; scaling 0.945 < 1.5.",
|
||||
"_rebaselined_callable_flow_2522_review": "PR #2522 review hardening: callable operands retain expression/qualified identity and formals retain signature metadata. Prior 29ce2bfe70b246b1c9d5e99c0ec11e850c22e9672737592207242b7f4cc824b8 -> 66a46d5ff09f3d11b2771db0f48596fe7057e95c5bc8f56241fdb911137298c3; scaling 1.054 < 1.5.",
|
||||
|
|
@ -187,7 +197,7 @@
|
|||
"_rebaselined_2900_record_heritage": "#2900 review follow-up: the Java scale unit now includes a record implementing Marker, so the record-declaration @reference.inherits path is fingerprinted and exercised at scale. Prior b29e263524f55151dcb7cfc4c929d3d1d7bb360355cee4e832158f927857f663 -> 36d689c58526c4482fbd701d1d9ca156623a3970734ead145717858712271ab5; scaling 1.042 < 1.5.",
|
||||
"_rebaselined_callable_flow_2522_review": "PR #2522 review hardening: callable operands retain expression/qualified identity and formals retain signature metadata; same-name lexical regions use an O(ancestor-depth) ID-set lookup. Prior d5c59d7dc9e206637515d5aea1163f7c1cdd76410c38c5fe6143d13d19677d6a -> 004a3592998dca1193bd1429a8284513725de7764f2a3eceedaaa984cfd763b4; scaling 0.992 < 1.5.",
|
||||
"_rebaselined_callable_flow_2522_followup": "PR #2522 follow-up: Java method-reference/SAM callable flow facts with invocation-result suppression. Prior 062d754764aaa8a6772fb90875c710502a63e3e7a300e633942381ed914faada -> d5c59d7dc9e206637515d5aea1163f7c1cdd76410c38c5fe6143d13d19677d6a; scaling 1.074 < 1.5.",
|
||||
"_rebaselined": "#2357 (supersedes #2353): + java-cast-receiver, java-this-field-chain, java-this-dispatch fixtures (cast-wrapped receivers, this.field chains incl. initializer contexts, bare-this dispatch pinning). Drift is purely fixture-additive: with the three new dirs parked, the fingerprint reproduces the prior baseline byte-identically \u2014 no emit/capture change. #1956 synth-widening: + java-iface-extends fixture; synthesizeJavaInheritanceReferences now ALSO walks interface_declaration extends_interfaces (interface IA extends IB, IC<T>), matching the #1940 legacy leg. (Earlier U2+review: java-qualified-base fixture covers 2- AND 3-segment qualified bases guarding the legacy end-anchor; synth tail-resolves scoped bases.) Linear (~1.03). (Earliest: java added to bench, exposed+fixed the O(n^2) findNodeAtRange root-walk; 3.09 -> ~0.99.) | #942: scope-resolution-only cleanup reworded fixture comments; capture byte-positions shift, capture LOGIC unchanged.",
|
||||
"_rebaselined": "#2357 (supersedes #2353): + java-cast-receiver, java-this-field-chain, java-this-dispatch fixtures (cast-wrapped receivers, this.field chains incl. initializer contexts, bare-this dispatch pinning). Drift is purely fixture-additive: with the three new dirs parked, the fingerprint reproduces the prior baseline byte-identically — no emit/capture change. #1956 synth-widening: + java-iface-extends fixture; synthesizeJavaInheritanceReferences now ALSO walks interface_declaration extends_interfaces (interface IA extends IB, IC<T>), matching the #1940 legacy leg. (Earlier U2+review: java-qualified-base fixture covers 2- AND 3-segment qualified bases guarding the legacy end-anchor; synth tail-resolves scoped bases.) Linear (~1.03). (Earliest: java added to bench, exposed+fixed the O(n^2) findNodeAtRange root-walk; 3.09 -> ~0.99.) | #942: scope-resolution-only cleanup reworded fixture comments; capture byte-positions shift, capture LOGIC unchanged.",
|
||||
"_note": "#1928 / #2045: F35 adds qualified + qualified-generic constructor query captures (`new pkg.Foo()`, `new a.b.Foo()`, `new pkg.Box<T>()`); F38 synthesizes `@reference.call.constructor` on `super(...)`/`this(...)` explicit_constructor_invocation nodes; F41 generic-aware stripQualifier in interpret (type-binding normalization). + java-qualified-constructor and java-explicit-constructor fixtures. Pure capture-additive + fixture-corpus drift; scaling stays linear (~1.06).",
|
||||
"_rebaselined_2522_review_fixes": "PR #2522 review fixes: get/test dropped from callableProtocolMethods. Prior 004a3592998dca1193bd1429a8284513725de7764f2a3eceedaaa984cfd763b4 -> f3b4f4b6610e07c3ac90deb1c53d3572b6ad55a36e5d7134984876d30031ff67; scaling ratio re-verified within budget.",
|
||||
"_rebaselined_2550_instance_model": "PR #2549 (#2550): anonymous class bodies emit synthesized @declaration.class/@declaration.name (Worker$N), an @reference.inherits to the constructed type, and receiver @type-binding.* captures; six new java-* fixtures joined the corpus. Prior f3b4f4b6610e07c3ac90deb1c53d3572b6ad55a36e5d7134984876d30031ff67 -> d79c3b92acfc866094981499b977388ca14f90839bca0c040342ab1cec00aa90; scaling 1.058 < 1.5.",
|
||||
|
|
@ -195,8 +205,8 @@
|
|||
"_rebaselined_2564_record_capture": "PR for #2564: JAVA_QUERIES gained a (record_declaration name: (identifier) @name) @definition.record capture, previously entirely missing (record_declaration had no structure-phase capture at all, unlike class/interface/enum) - a record's methods existed as ownerless Method nodes with no HAS_METHOD edge. Two new java-* fixtures (java-record-methods, java-new-expr-chain-call) joined the corpus. Prior 975b68aaac6d06094260fb0c67f9b1bc03692ba7220669d192aca9dccd5fc0ca -> 85fc7af9c3c1bceac76cb4f27214410b04967682a2eaa7e468e26efd1f4e2537; scaling 1.059 < 1.5.",
|
||||
"_rebaselined_2561_enum_constant_receiver": "PR for #2561: synthesizeJavaAnonymousClassDeclarations now emits a class-scope @type-binding.annotation/name/type per enum constant (constant simple name -> its E$N synthesized class when bodied, else the host enum) so E.CONST.method() resolves through the existing compound-receiver chain walk. Two drivers of the drift, both in the java-enum-constant-body fixture (this bench's corpus IS test/fixtures/lang-resolution): (1) one extra type-binding match per enum_constant from the capture change; (2) review follow-up added a body-less Plain.java enum + EnumConst.dispatchToConstant/dispatchInherited methods (bodied-override, inherited-via-MRO, and body-less dispatch call sites). The review's fail-safe hardening (bodied constant binds ONLY to E$N, never the host enum, when name synthesis fails on a malformed tree) is output-neutral on this well-formed corpus (verified: fingerprint identical with and without it). Prior 85fc7af9c3c1bceac76cb4f27214410b04967682a2eaa7e468e26efd1f4e2537 -> d04298a91beec76d0fa7099b3d71265723be60c1df688969aa954f135dd49686; scaling < 1.5.",
|
||||
"_rebaselined_2562_local_classes": "#2562: Java block-local classes, enums, records, and interfaces use source-type-relative JLS 13.1 Host$NLocal identities with javac-compatible per-(host, simple-name) numbering; anonymous numbering remains separate. Lexical aliases begin at each declaration and end with its immediate block. Expanded java-local-class-naming fixtures cover declaration order, disjoint blocks, initializers, lambdas, local type kinds, and recursive local/member/anonymous host chains. Prior d04298a91beec76d0fa7099b3d71265723be60c1df688969aa954f135dd49686 -> 6dd5913a58400a191ff54abf9b852b03d5add657d16c11e60a7c4608ba186197; scaling 1.204 < 1.5.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged \u2014 the tag is added to existing call matches, never a new match \u2014 so this is digest drift only. Prior 6dd5913a58400a191ff54abf9b852b03d5add657d16c11e60a7c4608ba186197 -> 310adbc2e0827b5ac749acaa981cd12d256fc5b7cbc5592c5bee219e92abf9ee.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|\u2026` instead of `1|\u2026`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 310adbc2e0827b5ac749acaa981cd12d256fc5b7cbc5592c5bee219e92abf9ee -> a9943355e945e03ddb87c800f4cc1f62b3d04feefb3ec64c258d8e0bb3b3fcd9.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged — the tag is added to existing call matches, never a new match — so this is digest drift only. Prior 6dd5913a58400a191ff54abf9b852b03d5add657d16c11e60a7c4608ba186197 -> 310adbc2e0827b5ac749acaa981cd12d256fc5b7cbc5592c5bee219e92abf9ee.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|…` instead of `1|…`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 310adbc2e0827b5ac749acaa981cd12d256fc5b7cbc5592c5bee219e92abf9ee -> a9943355e945e03ddb87c800f4cc1f62b3d04feefb3ec64c258d8e0bb3b3fcd9.",
|
||||
"capture_groups_small": 6255,
|
||||
"capture_groups_large": 20005,
|
||||
"capture_groups_fp": 3586,
|
||||
|
|
@ -210,8 +220,8 @@
|
|||
"_rebaselined_2935_synthetic_declarations": "PR #2935 review follow-up: the local-type stress corpus includes synthesized anonymous declarations, which now carry the presence-only @declaration.is-synthetic sidecar. DIGEST DRIFT ONLY, NOT A CAPTURE-SET CHANGE. Prior 8c50bbc83dff4f7f5abd06078aa6abc6b64af05fddb17ee826b5f3df3d346633 -> 560734cd053fb4f4b23aa04bc7870c22089a8deedb0217fa9c1b4db689e02a97; CI scaling 1.002 < 1.5.",
|
||||
"_rebaselined_2917_record_component_accessors": "#2917: the focused local-type fixture corpus contains local records, so their implicit component accessors add the same bounded scope/declaration captures as the general Java corpus. No local-type naming logic changed. Prior 8c50bbc83dff4f7f5abd06078aa6abc6b64af05fddb17ee826b5f3df3d346633 -> 3e22f368a4ee139be7cb91ff4fb77ddadf60c55efe8d66955ec81f366a46e460; scaling 1.032 < 1.5, capture_groups_fp 680. Re-measured on top of #2935's is-synthetic sidecar after merging origin/main: 560734cd053fb4f4b23aa04bc7870c22089a8deedb0217fa9c1b4db689e02a97 -> bdde823fa725e636e257940efb4c8655aa23124c1727cbaa8856d1ad8f71729e; scaling 0.997 < 1.5, capture_groups_fp 680.",
|
||||
"_added": "#2562 performance follow-up: co-scales same-host, same-name local classes and anonymous classes to gate JLS binary-name ordinal allocation. Precomputed per-sequence ordinals reduce the focused 100->800 workload from 176->6655ms to 141->752ms; normalized 250->800 scaling is 1.054.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged \u2014 the tag is added to existing call matches, never a new match \u2014 so this is digest drift only. Prior a9ad88de21ca6747a923260dbdf677fb74a004abbf9d57781f745e3a9027530b -> 3ca67847ea2b9a71b0a41e09f943767e5a2d3a113d3e203499ee364e37f40236.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|\u2026` instead of `1|\u2026`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 3ca67847ea2b9a71b0a41e09f943767e5a2d3a113d3e203499ee364e37f40236 -> 8c50bbc83dff4f7f5abd06078aa6abc6b64af05fddb17ee826b5f3df3d346633.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged — the tag is added to existing call matches, never a new match — so this is digest drift only. Prior a9ad88de21ca6747a923260dbdf677fb74a004abbf9d57781f745e3a9027530b -> 3ca67847ea2b9a71b0a41e09f943767e5a2d3a113d3e203499ee364e37f40236.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|…` instead of `1|…`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 3ca67847ea2b9a71b0a41e09f943767e5a2d3a113d3e203499ee364e37f40236 -> 8c50bbc83dff4f7f5abd06078aa6abc6b64af05fddb17ee826b5f3df3d346633.",
|
||||
"capture_groups_fp": 680,
|
||||
"_rebaselined_3486_semantic_rename": "#3486: Compared actual origin/main (191a954b), committed dd3bf and frozen provider source over the same unchanged corpus. 2 constructor-parameter type bindings are added and 38 duplicate qualified free-call matches are removed. Every removed free-call match retains a member-call match with the identical call anchor and name capture. Fixture entries 6; changed entries 6; capture groups 680 -> 644. Fingerprint regenerated from the runner's canonicalized capture records. Scaling budgets unchanged."
|
||||
},
|
||||
|
|
@ -222,26 +232,26 @@
|
|||
"_rebaselined_3446_mcp_tools_fixture": "#3446 adds typescript-mcp-tools/src/{handlers,server,tools}.ts: corpus growth only, with fixture_count 171 -> 174 and capture_groups_fp 2753 -> 2894. Excluding only that fixture directory restores the prior fingerprint 77c9b4ea654123a64972db8348190ec250b669472b150db65ea8c7f20b355467 exactly. The scope emitter, synthetic capture counts (4503/14403), scaling budget, and other language baselines are unchanged.",
|
||||
"_rebaselined_3190": "Capture matches now retain explicit ESM export/private evidence, including synthesized default HOCs; CommonJS surfaces remain undecided. Capture group counts unchanged. Scaling budget unchanged.",
|
||||
"scaling_budget": 1.5,
|
||||
"_rebaselined_2934_import_type_only": "#2934: `import-decomposer.ts` attaches a presence-only `@import.type-only` synthetic capture to specifiers `tsc` erases, so `check --cycles` can stop counting type-only edges as initialization cycles. DIGEST DRIFT ONLY, NOT A CAPTURE-SET CHANGE \u2014 the tag is added to import matches that already existed, never a new match, the same shape as the #2747 receiver-chain rebaseline. Every count is unchanged: capture_groups_fp 2414, fixture_count 155, capture_groups_small/large 4503/14403 (those measure the SYNTHETIC scaling source, which has no imports at all). The fingerprint moves because `canonicalizeMatch` in measure.mjs hashes every TAG on every match, synthetics included, so one extra presence-only tag on an existing match rewrites that match's canonical string. Attribution is exact, not inferred: neutralizing ONLY the `m['@import.type-only'] = \u2026` assignment in import-decomposer.ts and re-running returns the fingerprint to c2fbf8a89e5686dd\u2026 byte-for-byte, so nothing else in the TypeScript capture stream moved. All 14 other languages report ok. Scaling 0.997 < 1.5. NOTE ON THE CONTROL: javascript did not move (2026993b\u2026, 43 fixtures), but it is a WEAK control here \u2014 `import type` is TypeScript-only syntax, so a JS corpus cannot express the construct and could not have drifted either way. It evidences no collateral damage, not the correctness of the TS change; the exact-attribution check above is what does that. Prior c2fbf8a89e5686dd1ff3659b20d41d8b05ebcc9790356e3653ee0c8ca5d365c8 -> f719163eb03a447c9e40ca316a905dd76cee82192a75a403df478ebbdc13e98f.",
|
||||
"_rebaselined_2934_import_type_only": "#2934: `import-decomposer.ts` attaches a presence-only `@import.type-only` synthetic capture to specifiers `tsc` erases, so `check --cycles` can stop counting type-only edges as initialization cycles. DIGEST DRIFT ONLY, NOT A CAPTURE-SET CHANGE — the tag is added to import matches that already existed, never a new match, the same shape as the #2747 receiver-chain rebaseline. Every count is unchanged: capture_groups_fp 2414, fixture_count 155, capture_groups_small/large 4503/14403 (those measure the SYNTHETIC scaling source, which has no imports at all). The fingerprint moves because `canonicalizeMatch` in measure.mjs hashes every TAG on every match, synthetics included, so one extra presence-only tag on an existing match rewrites that match's canonical string. Attribution is exact, not inferred: neutralizing ONLY the `m['@import.type-only'] = …` assignment in import-decomposer.ts and re-running returns the fingerprint to c2fbf8a89e5686dd… byte-for-byte, so nothing else in the TypeScript capture stream moved. All 14 other languages report ok. Scaling 0.997 < 1.5. NOTE ON THE CONTROL: javascript did not move (2026993b…, 43 fixtures), but it is a WEAK control here — `import type` is TypeScript-only syntax, so a JS corpus cannot express the construct and could not have drifted either way. It evidences no collateral damage, not the correctness of the TS change; the exact-attribution check above is what does that. Prior c2fbf8a89e5686dd1ff3659b20d41d8b05ebcc9790356e3653ee0c8ca5d365c8 -> f719163eb03a447c9e40ca316a905dd76cee82192a75a403df478ebbdc13e98f.",
|
||||
"_rebaselined_callable_flow_2522_review": "PR #2522 review hardening: callable operands retain expression/qualified identity and formals retain signature metadata. Prior 27f937bfb47d4bded316ea3c785ff659c8cd88a5761d928f113477a08c802c78 -> e05446620c5b80b7aae291cfdf32f693580fada2ae687124769b04a0c03bfe63; scaling 0.983 < 1.5.",
|
||||
"_rebaselined_callable_flow_2522_followup": "PR #2522 follow-up: lexical callable bindings, direct-callee argument metadata, and invocation-result suppression. Prior db5933cc6760234ed7d495123410feba6de243646d583f20d43032b9459f81fd -> 27f937bfb47d4bded316ea3c785ff659c8cd88a5761d928f113477a08c802c78; scaling 0.975 < 1.5.",
|
||||
"_rebaselined_callable_flow": "Callable assignment/copy/formal/argument/invoke facts (also consumed by Vue script blocks). Prior 25de86fd3377132c4e35d3d98f4f94a58e0cfeb7c22948a8ea3be4e793be74fd -> db5933cc6760234ed7d495123410feba6de243646d583f20d43032b9459f81fd; measured scaling ratio 0.951 < 1.5.",
|
||||
"_rebaselined": "#1962: F44 (class scope@), F85 (enum member declarations), F87 (optional_parameter type annotations) add new captures \u2014 fingerprint drift expected.",
|
||||
"_note": "#1968: F44, F85, F87 \u2014 fingerprint drift expected.",
|
||||
"_rebaselined": "#1962: F44 (class scope@), F85 (enum member declarations), F87 (optional_parameter type annotations) add new captures — fingerprint drift expected.",
|
||||
"_note": "#1968: F44, F85, F87 — fingerprint drift expected.",
|
||||
"_rebaselined_2522": "#2522 intentional @reference.value-ref/property-key capture additions. GitHub Actions run 29553361660 job 87800394279: prior 3f44a4a6892698df2d145c8ff2812c3b318807648983c88aca28fbd694f172f9 -> 25de86fd3377132c4e35d3d98f4f94a58e0cfeb7c22948a8ea3be4e793be74fd; scaling ratio 0.987 < 1.5.",
|
||||
"_rebaselined_2550_instance_model": "PR #2549 (#2545/#2551): object literals emit @scope.object (was unscoped, then @scope.block during development). Prior e05446620c5b80b7aae291cfdf32f693580fada2ae687124769b04a0c03bfe63 -> 3280b13d3f9378ab23eee31c2edc779b5a9ae1e7bb510c23a24855b44406d2f4; scaling 0.981 < 1.5.",
|
||||
"_rebaselined_receiver_owner_2701": "#2701: every non-arrow function form now carries a `@receiver-owner.this` marker on the same node as `@scope.function`, so a scope that BINDS its own `this` can stop the receiver walk (`Scope.ownsReceivers`). Verified before re-baselining by diffing the capture-name histogram over this same fixture corpus against 1d3088173f6f93827641b476d614d5d15cd4f3ea: the ONLY delta is @receiver-owner.this (typescript +143, javascript +32) \u2014 every other capture count is byte-identical, so no existing capture moved. Prior 3280b13d3f9378ab23eee31c2edc779b5a9ae1e7bb510c23a24855b44406d2f4 -> 281e95484203b481094729ca249ef0423c41273eac35e424cdfd032a0dac7699.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged \u2014 the tag is added to existing call matches, never a new match \u2014 so this is digest drift only. Prior cad25be9f81d6e021ebae8dcb166bc0af3a1ba8021f1506f6ca93fd4c2649000 -> 9e112415f1169f08576826c12ea1d137d1994e34b44c45986c9ffee83b8b4edc.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|\u2026` instead of `1|\u2026`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 9e112415f1169f08576826c12ea1d137d1994e34b44c45986c9ffee83b8b4edc -> cdefe88d3c275f31953216c676ef32c7bf5727d56b9c3840b81ee6bf85749dff.",
|
||||
"_rebaselined_inferred_field_receiver_2807": "#2807: inference-typed class fields now emit a type binding \u2014 `public_field_definition` with a `new_expression` value, and `this.<field> = new ...` carrying a @type-binding.this-field marker. ADDS @type-binding.constructor captures only; no capture is removed, and the annotated form is unchanged because annotation outranks constructor-inferred in typeBindingStrength. Prior cdefe88d3c275f31953216c676ef32c7bf5727d56b9c3840b81ee6bf85749dff -> 248b56f0d7a0a6fc7a949dc7afb8611e135ed642bccc2631b96ebb9d686bb965; scaling 0.994 < 1.5.",
|
||||
"_rebaselined_ts_heritage_2842": "#2842 review: TypeScript heritage capture now emits `@reference.inherits` for `interface_declaration` (bases on `extends_type_clause`) and `abstract_class_declaration` (bases on `class_heritage`), which were both silently skipped \u2014 so `interface B extends A` and `abstract class X implements I` produced no edge and every interface-dispatch walk dead-ended on a bodiless declaration. Verified before re-baselining by diffing the capture-name histogram over this same fixture corpus (145 files) with and without the change: the ONLY deltas are @reference.inherits 17 -> 20 (+3) and its paired @reference.name 245 -> 248 (+3), emitted together by emitTsInheritanceBase. Every other capture count is byte-identical, so no existing capture moved. The +3 is the three `interface X extends BasePayload` declarations in typescript-generic-calls/src/{auth,admin,guest}.ts. javascript is unchanged (no interfaces in the language). Prior 248b56f0d7a0a6fc7a949dc7afb8611e135ed642bccc2631b96ebb9d686bb965 -> 7a960908031331360ce582f5b55b7681e1cd7f8a2eabfd73c00982cb17f2a949.",
|
||||
"_rebaselined_receiver_owner_2701": "#2701: every non-arrow function form now carries a `@receiver-owner.this` marker on the same node as `@scope.function`, so a scope that BINDS its own `this` can stop the receiver walk (`Scope.ownsReceivers`). Verified before re-baselining by diffing the capture-name histogram over this same fixture corpus against 1d3088173f6f93827641b476d614d5d15cd4f3ea: the ONLY delta is @receiver-owner.this (typescript +143, javascript +32) — every other capture count is byte-identical, so no existing capture moved. Prior 3280b13d3f9378ab23eee31c2edc779b5a9ae1e7bb510c23a24855b44406d2f4 -> 281e95484203b481094729ca249ef0423c41273eac35e424cdfd032a0dac7699.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged — the tag is added to existing call matches, never a new match — so this is digest drift only. Prior cad25be9f81d6e021ebae8dcb166bc0af3a1ba8021f1506f6ca93fd4c2649000 -> 9e112415f1169f08576826c12ea1d137d1994e34b44c45986c9ffee83b8b4edc.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|…` instead of `1|…`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 9e112415f1169f08576826c12ea1d137d1994e34b44c45986c9ffee83b8b4edc -> cdefe88d3c275f31953216c676ef32c7bf5727d56b9c3840b81ee6bf85749dff.",
|
||||
"_rebaselined_inferred_field_receiver_2807": "#2807: inference-typed class fields now emit a type binding — `public_field_definition` with a `new_expression` value, and `this.<field> = new ...` carrying a @type-binding.this-field marker. ADDS @type-binding.constructor captures only; no capture is removed, and the annotated form is unchanged because annotation outranks constructor-inferred in typeBindingStrength. Prior cdefe88d3c275f31953216c676ef32c7bf5727d56b9c3840b81ee6bf85749dff -> 248b56f0d7a0a6fc7a949dc7afb8611e135ed642bccc2631b96ebb9d686bb965; scaling 0.994 < 1.5.",
|
||||
"_rebaselined_ts_heritage_2842": "#2842 review: TypeScript heritage capture now emits `@reference.inherits` for `interface_declaration` (bases on `extends_type_clause`) and `abstract_class_declaration` (bases on `class_heritage`), which were both silently skipped — so `interface B extends A` and `abstract class X implements I` produced no edge and every interface-dispatch walk dead-ended on a bodiless declaration. Verified before re-baselining by diffing the capture-name histogram over this same fixture corpus (145 files) with and without the change: the ONLY deltas are @reference.inherits 17 -> 20 (+3) and its paired @reference.name 245 -> 248 (+3), emitted together by emitTsInheritanceBase. Every other capture count is byte-identical, so no existing capture moved. The +3 is the three `interface X extends BasePayload` declarations in typescript-generic-calls/src/{auth,admin,guest}.ts. javascript is unchanged (no interfaces in the language). Prior 248b56f0d7a0a6fc7a949dc7afb8611e135ed642bccc2631b96ebb9d686bb965 -> 7a960908031331360ce582f5b55b7681e1cd7f8a2eabfd73c00982cb17f2a949.",
|
||||
"capture_groups_small": 4503,
|
||||
"capture_groups_large": 14403,
|
||||
"capture_groups_fp": 2465,
|
||||
"fixture_count": 167,
|
||||
"_rebaselined_blind_spots_2856": "#2856 blind-spots series: the JS/TS SCOPE queries gained capture rules, so fingerprint drift is expected and additive. Verified before re-baselining by diffing the capture-name sets in both scope queries against origin/main: TypeScript gained exactly @reference.read.identifier (A2 bare-identifier reads in value positions) and @reference.type (R2-2 type references, so a declared contract stops reporting incoming:{}); JavaScript gained exactly @reference.read.identifier, @reference.read.destructured (R2-1c) and @reference.write.property-key (R2-1b record-construction writes). NOTHING was removed on either side \u2014 the delta is a pure superset, which is the check that no existing capture moved. capture_groups_small/large are unchanged (4503/14403) because those measure the SYNTHETIC scaling source, which this branch does not touch; only the fixture-corpus count moves. capture_groups_fp 2097 -> 2338 and fixture_count 146 -> 151 from 21 new lang-resolution fixtures. Scaling stayed linear and inside budget: typescript 1.116 < 1.5, javascript 1.010 < 1.5. Prior typescript ed92588e0fc7b28b3a0174339ac378b4dd85965fe007db1208dea97a65ce0571 -> f66a3e6f1e096431e7046505129a627deaa00ca0de5bc846b080591b397248f7; prior javascript 806f70ad3cce5fc849f6d06a08ace8a95f92a1ea84a2418fddabb1eef5846594 -> 2026993b81b873839dd2ef8797d9c14d9c48516b2b57b05ac17d8d43f2f4eba3.",
|
||||
"_rebaselined_type_parameter_shadowing_w2_8": "W2-8: `@declaration.type-parameters` is now captured on generic FUNCTIONS, generator functions and type ALIASES, not only on class/interface declarations. NO NEW CAPTURE NAME \u2014 verified by diffing the capture-name sets against the wave-1 branch, which returns empty; the tag already existed and simply fires on more declarations. That is the whole delta: capture_groups_fp 2338 -> 2371 (+33 occurrences of an existing tag) and fixture_count 151 -> 152 (one new fixture, typescript-type-parameters). capture_groups_small/large unchanged at 4503/14403, since those measure the synthetic scaling source this does not touch. Scaling 1.06 < 1.5. JavaScript is untouched \u2014 it has no type parameters \u2014 and its fingerprint does not move, which is the check that this is the TS declaration rules and not something broader. Prior f66a3e6f1e096431e7046505129a627deaa00ca0de5bc846b080591b397248f7 -> 62c7f1bfbe568eed927fb78f00061ed5e49d12511fd8260648b876df386f3b4c.",
|
||||
"_rebaselined_2899_review_type_parameter_scope_fixtures": "PR #2899 review follow-up: FIXTURE-CORPUS GROWTH ONLY \u2014 no query rule changed and no capture name was added or removed. `typescript/query.ts` is byte-identical to the previous baseline; the type-parameter shadowing defect was fixed on the RESOLUTION side (`walkers.ts` gains a `declarationOpenedScope` gate so a declaration's `typeParameters` bind only inside the scope that declaration opened, and the `USES` guard moved from `graph-bridge/references-to-edges.ts` to `resolve-references.ts` where the spelled `site.name` is in hand). The fingerprint moves because measure.mjs fingerprints the whole `lang-resolution/typescript-*` fixture corpus and the regression tests add three files to `typescript-type-parameters/src/` (values.ts, aliased.ts, namespaced.ts) plus two scope-less generic aliases in shapes.ts. Per-file accounting sums exactly to the delta: shapes.ts 33->35 (+2), values.ts +11, aliased.ts +10, namespaced.ts +20 = +43. capture_groups_fp 2371 -> 2414; fixture_count 152 -> 155. capture_groups_small/large unchanged at 4503/14403 (they measure the SYNTHETIC scaling source, untouched). JAVASCRIPT IS THE CONTROL AND DID NOT MOVE (fingerprint 2026993b..., 43 fixtures) \u2014 which is the check that this is corpus growth and not a capture regression; all 14 other languages report `ok`. Scaling 0.976 < 1.5. Prior 62c7f1bfbe568eed927fb78f00061ed5e49d12511fd8260648b876df386f3b4c -> c2fbf8a89e5686dd1ff3659b20d41d8b05ebcc9790356e3653ee0c8ca5d365c8.",
|
||||
"_rebaselined_blind_spots_2856": "#2856 blind-spots series: the JS/TS SCOPE queries gained capture rules, so fingerprint drift is expected and additive. Verified before re-baselining by diffing the capture-name sets in both scope queries against origin/main: TypeScript gained exactly @reference.read.identifier (A2 bare-identifier reads in value positions) and @reference.type (R2-2 type references, so a declared contract stops reporting incoming:{}); JavaScript gained exactly @reference.read.identifier, @reference.read.destructured (R2-1c) and @reference.write.property-key (R2-1b record-construction writes). NOTHING was removed on either side — the delta is a pure superset, which is the check that no existing capture moved. capture_groups_small/large are unchanged (4503/14403) because those measure the SYNTHETIC scaling source, which this branch does not touch; only the fixture-corpus count moves. capture_groups_fp 2097 -> 2338 and fixture_count 146 -> 151 from 21 new lang-resolution fixtures. Scaling stayed linear and inside budget: typescript 1.116 < 1.5, javascript 1.010 < 1.5. Prior typescript ed92588e0fc7b28b3a0174339ac378b4dd85965fe007db1208dea97a65ce0571 -> f66a3e6f1e096431e7046505129a627deaa00ca0de5bc846b080591b397248f7; prior javascript 806f70ad3cce5fc849f6d06a08ace8a95f92a1ea84a2418fddabb1eef5846594 -> 2026993b81b873839dd2ef8797d9c14d9c48516b2b57b05ac17d8d43f2f4eba3.",
|
||||
"_rebaselined_type_parameter_shadowing_w2_8": "W2-8: `@declaration.type-parameters` is now captured on generic FUNCTIONS, generator functions and type ALIASES, not only on class/interface declarations. NO NEW CAPTURE NAME — verified by diffing the capture-name sets against the wave-1 branch, which returns empty; the tag already existed and simply fires on more declarations. That is the whole delta: capture_groups_fp 2338 -> 2371 (+33 occurrences of an existing tag) and fixture_count 151 -> 152 (one new fixture, typescript-type-parameters). capture_groups_small/large unchanged at 4503/14403, since those measure the synthetic scaling source this does not touch. Scaling 1.06 < 1.5. JavaScript is untouched — it has no type parameters — and its fingerprint does not move, which is the check that this is the TS declaration rules and not something broader. Prior f66a3e6f1e096431e7046505129a627deaa00ca0de5bc846b080591b397248f7 -> 62c7f1bfbe568eed927fb78f00061ed5e49d12511fd8260648b876df386f3b4c.",
|
||||
"_rebaselined_2899_review_type_parameter_scope_fixtures": "PR #2899 review follow-up: FIXTURE-CORPUS GROWTH ONLY — no query rule changed and no capture name was added or removed. `typescript/query.ts` is byte-identical to the previous baseline; the type-parameter shadowing defect was fixed on the RESOLUTION side (`walkers.ts` gains a `declarationOpenedScope` gate so a declaration's `typeParameters` bind only inside the scope that declaration opened, and the `USES` guard moved from `graph-bridge/references-to-edges.ts` to `resolve-references.ts` where the spelled `site.name` is in hand). The fingerprint moves because measure.mjs fingerprints the whole `lang-resolution/typescript-*` fixture corpus and the regression tests add three files to `typescript-type-parameters/src/` (values.ts, aliased.ts, namespaced.ts) plus two scope-less generic aliases in shapes.ts. Per-file accounting sums exactly to the delta: shapes.ts 33->35 (+2), values.ts +11, aliased.ts +10, namespaced.ts +20 = +43. capture_groups_fp 2371 -> 2414; fixture_count 152 -> 155. capture_groups_small/large unchanged at 4503/14403 (they measure the SYNTHETIC scaling source, untouched). JAVASCRIPT IS THE CONTROL AND DID NOT MOVE (fingerprint 2026993b..., 43 fixtures) — which is the check that this is corpus growth and not a capture regression; all 14 other languages report `ok`. Scaling 0.976 < 1.5. Prior 62c7f1bfbe568eed927fb78f00061ed5e49d12511fd8260648b876df386f3b4c -> c2fbf8a89e5686dd1ff3659b20d41d8b05ebcc9790356e3653ee0c8ca5d365c8.",
|
||||
"_rebaselined_2953_workspace_fixture": "#2953 adds test/fixtures/lang-resolution/typescript-pnpm-workspace-imports, a pnpm monorepo of 12 .ts files, and the TypeScript capture corpus is collected from test/fixtures. CORPUS GROWTH ONLY, NOT A CAPTURE CHANGE: fixture_count 155 -> 167 and capture_groups_fp 2414 -> 2465 are the 12 new files' own matches; capture_groups_small/large are unchanged at 4503/14403 because those measure the SYNTHETIC scaling source, which the fixture corpus does not feed. Attribution is exact rather than inferred: moving that one fixture directory aside and re-running returns typescript to f719163eb03a447c9e40ca316a905dd76cee82192a75a403df478ebbdc13e98f byte-for-byte with fixture_count back at 155, and [scope-capture --check] PASSES for all 15 languages - so nothing in the TypeScript capture stream moved. #2953 changes import RESOLUTION, which runs after capture and feeds no capture tag. Prior f719163eb03a447c9e40ca316a905dd76cee82192a75a403df478ebbdc13e98f -> 05d1dadd6c9ef35c74079fa50f341b1b36e4fb02c9a89dd1b59f32b7cfd5e633.",
|
||||
"_rebaselined_1432_member_call_callee_name": "#1432 (Zig): the shared callable-flow reader no longer names a callee by simple name for a MEMBER call (`@callable-flow.direct-callee-name` requires a direct designator: `f(x)`, `ns.f(x)`), and a member call is a field-stored-callable invoke only when a MEMBER store (`o.f = handler`) or a declared callable-typed field is visible - a same-named plain binding no longer gates it. CAPTURE-EMISSION CHANGE, not fixture growth (fixture_count unchanged). Drift: `await svc.verify<GuestPayload>(token, ...)` (typescript-generic-calls/src/guest.ts, member call) and `initializer()(() => {...})` (typescript-hof-callbacks/src/store.ts, call-of-call) lose `direct-callee-name`. `await verifyToken<AdminPayload>(token, ...)` (admin.ts/auth.ts) KEEPS `direct-callee-name|verifyToken`: tree-sitter-typescript parses `await f<T>(x)` as call_expression(function: await_expression(f), type_arguments, ...), and wrappedExpression now unwraps `await_expression` so the direct designator survives as it does for the un-awaited spelling. capture_groups_fp 2465 (unchanged). Prior 05d1dadd6c9ef35c74079fa50f341b1b36e4fb02c9a89dd1b59f32b7cfd5e633 -> fed04ed1d5db112387781e405da208ae6b3ab803889773b0455be96f01b893ff.",
|
||||
"_rebaselined_3354_callable_alternatives": "#3354 callable alternatives: a callable chosen by a value-selecting source now flows every branch it can yield (`a ?? b`, `a || b`, `a or b`, `c ? a : b`, statement `if`, elvis), and an operator branch (`x == f || g`) stays opaque instead of seeding a qualified name. Verified by running the BASE (merge-base 233ca2849) and HEAD emitters over the SAME HEAD fixture corpus: every added or removed match is an `@callable-flow.*` match on one of those sources, and the pre-existing corpus is byte-identical (all other languages: zero delta). The rest of the drift is corpus growth from this PR's regression fixture, which this bench globs. Corpus growth: typescript-callable-alternatives/{index,compare,worker,sweep/index}.ts (+4 files, +288 groups). Emitter delta: +18 / -14: `??` / `||` / `&&` / ternary seeds and copies now name each operand (`&&` its right operand only); the 14 removed matches are the whole-expression seeds and copies carrying a qualified name of the compound source, including the comparison branches in compare.ts that now stay opaque. capture_groups_fp 2465 -> 2753, fixture_count 167 -> 171; synthetic counts unchanged; scaling 0.963 < 1.5. Prior 60e75bbe846f7200005f12c4d95c32e82d9d3feae9f2fd594e484670762b82b0 -> 77c9b4ea654123a64972db8348190ec250b669472b150db65ea8c7f20b355467.",
|
||||
|
|
@ -259,10 +269,10 @@
|
|||
"_rebaselined": "#1956 synth-widening: + javascript-qualified-base fixture; synthesizeJsInheritanceReferences now handles a member_expression base (class S extends ns.Base -> Base), matching the #1940 legacy leg + the TS terminalTsTypeNameNode property_identifier case, at parity. Linear (~1.05). | #942: scope-resolution-only cleanup reworded fixture comments; capture byte-positions shift, capture LOGIC unchanged.",
|
||||
"_rebaselined_2522": "#2522 intentional @reference.value-ref/property-key capture additions. GitHub Actions run 29553361660 job 87800394279: prior d72f03c6c502235d2d4b74d66baa5c7d361f040d7a1b72e84acad61210d05ae8 -> 5567dd47e7ba29821a518c4a9852adc3b774e25ef3e7a6e2b3ecb7b59ddab73c; scaling ratio 1.031 < 1.5.",
|
||||
"_rebaselined_2550_instance_model": "PR #2549 (#2545/#2551): object literals emit @scope.object. Prior 479927409bbdd9852a36172c8260aa56df260e99129a7a9c20a0d1903dd5538b -> f1ccf42a36895c8e34dcb724286f247d469835f2dcbb23ad3347190adc7fde1c; scaling 1.096 < 1.5.",
|
||||
"_rebaselined_receiver_owner_2701": "#2701: every non-arrow function form now carries a `@receiver-owner.this` marker on the same node as `@scope.function`, so a scope that BINDS its own `this` can stop the receiver walk (`Scope.ownsReceivers`). Verified before re-baselining by diffing the capture-name histogram over this same fixture corpus against 1d3088173f6f93827641b476d614d5d15cd4f3ea: the ONLY delta is @receiver-owner.this (typescript +143, javascript +32) \u2014 every other capture count is byte-identical, so no existing capture moved. Prior f1ccf42a36895c8e34dcb724286f247d469835f2dcbb23ad3347190adc7fde1c -> 90601494695b834d3a9af7ac4844eac603f4f432809a05554cc59de0674a4354.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged \u2014 the tag is added to existing call matches, never a new match \u2014 so this is digest drift only. Prior 1c71ef628eb75a3b111afa8c2a7c351c16a7f5aab9fac2f098f82b2866312aa8 -> 83344b7cba093702f4528eeee44e438809c229d43b12e69ed288812ce7ffc7bc.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|\u2026` instead of `1|\u2026`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 83344b7cba093702f4528eeee44e438809c229d43b12e69ed288812ce7ffc7bc -> 806f70ad3cce5fc849f6d06a08ace8a95f92a1ea84a2418fddabb1eef5846594.",
|
||||
"_rebaselined_blind_spots_2856": "#2856 blind-spots series: the JS/TS SCOPE queries gained capture rules, so fingerprint drift is expected and additive. Verified before re-baselining by diffing the capture-name sets in both scope queries against origin/main: TypeScript gained exactly @reference.read.identifier (A2 bare-identifier reads in value positions) and @reference.type (R2-2 type references, so a declared contract stops reporting incoming:{}); JavaScript gained exactly @reference.read.identifier, @reference.read.destructured (R2-1c) and @reference.write.property-key (R2-1b record-construction writes). NOTHING was removed on either side \u2014 the delta is a pure superset, which is the check that no existing capture moved. capture_groups_small/large are unchanged (4503/14403) because those measure the SYNTHETIC scaling source, which this branch does not touch; only the fixture-corpus count moves. capture_groups_fp 2097 -> 2338 and fixture_count 146 -> 151 from 21 new lang-resolution fixtures. Scaling stayed linear and inside budget: typescript 1.116 < 1.5, javascript 1.010 < 1.5. Prior typescript ed92588e0fc7b28b3a0174339ac378b4dd85965fe007db1208dea97a65ce0571 -> f66a3e6f1e096431e7046505129a627deaa00ca0de5bc846b080591b397248f7; prior javascript 806f70ad3cce5fc849f6d06a08ace8a95f92a1ea84a2418fddabb1eef5846594 -> 2026993b81b873839dd2ef8797d9c14d9c48516b2b57b05ac17d8d43f2f4eba3."
|
||||
"_rebaselined_receiver_owner_2701": "#2701: every non-arrow function form now carries a `@receiver-owner.this` marker on the same node as `@scope.function`, so a scope that BINDS its own `this` can stop the receiver walk (`Scope.ownsReceivers`). Verified before re-baselining by diffing the capture-name histogram over this same fixture corpus against 1d3088173f6f93827641b476d614d5d15cd4f3ea: the ONLY delta is @receiver-owner.this (typescript +143, javascript +32) — every other capture count is byte-identical, so no existing capture moved. Prior f1ccf42a36895c8e34dcb724286f247d469835f2dcbb23ad3347190adc7fde1c -> 90601494695b834d3a9af7ac4844eac603f4f432809a05554cc59de0674a4354.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged — the tag is added to existing call matches, never a new match — so this is digest drift only. Prior 1c71ef628eb75a3b111afa8c2a7c351c16a7f5aab9fac2f098f82b2866312aa8 -> 83344b7cba093702f4528eeee44e438809c229d43b12e69ed288812ce7ffc7bc.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|…` instead of `1|…`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior 83344b7cba093702f4528eeee44e438809c229d43b12e69ed288812ce7ffc7bc -> 806f70ad3cce5fc849f6d06a08ace8a95f92a1ea84a2418fddabb1eef5846594.",
|
||||
"_rebaselined_blind_spots_2856": "#2856 blind-spots series: the JS/TS SCOPE queries gained capture rules, so fingerprint drift is expected and additive. Verified before re-baselining by diffing the capture-name sets in both scope queries against origin/main: TypeScript gained exactly @reference.read.identifier (A2 bare-identifier reads in value positions) and @reference.type (R2-2 type references, so a declared contract stops reporting incoming:{}); JavaScript gained exactly @reference.read.identifier, @reference.read.destructured (R2-1c) and @reference.write.property-key (R2-1b record-construction writes). NOTHING was removed on either side — the delta is a pure superset, which is the check that no existing capture moved. capture_groups_small/large are unchanged (4503/14403) because those measure the SYNTHETIC scaling source, which this branch does not touch; only the fixture-corpus count moves. capture_groups_fp 2097 -> 2338 and fixture_count 146 -> 151 from 21 new lang-resolution fixtures. Scaling stayed linear and inside budget: typescript 1.116 < 1.5, javascript 1.010 < 1.5. Prior typescript ed92588e0fc7b28b3a0174339ac378b4dd85965fe007db1208dea97a65ce0571 -> f66a3e6f1e096431e7046505129a627deaa00ca0de5bc846b080591b397248f7; prior javascript 806f70ad3cce5fc849f6d06a08ace8a95f92a1ea84a2418fddabb1eef5846594 -> 2026993b81b873839dd2ef8797d9c14d9c48516b2b57b05ac17d8d43f2f4eba3."
|
||||
},
|
||||
"kotlin": {
|
||||
"fingerprint": "026392f9a60d9808dd993fa6d26f3a2ca6240ed6ac63981d614058ae7acd29e2",
|
||||
|
|
@ -274,13 +284,13 @@
|
|||
"_rebaselined_callable_flow_2522_followup": "PR #2522 follow-up: Kotlin callable-reference flow facts with invocation-result suppression. Prior 4900431791f2b9280009deb2b82659c26ead8aa6fb8731190a7c505dec5a9041 -> bddba25d5a88152bbbee8d70e82c944b5302accb4b625df782adb1d4f7a7ac12; scaling 0.880 < 1.5.",
|
||||
"_added": "#1951: bench coverage added (was ungated); scale source heritage-bearing (: Base()); js/kotlin O(n^2) findNodeAtRange-per-match fixed to threaded captured node, now linear.",
|
||||
"_rebaselined": "#1919 review CF3 fix: extended kotlin-local-property-owner (init/accessor destructuring) + new dart-accessor-owner fixture (getter/setter ownership). Fingerprint-only corpus drift; scaling ~1.0.",
|
||||
"_rebaselined_2271": "PR #2271: re-vendored tree-sitter-kotlin 0.3.8 -> unreleased fwcd main c8ac3d26 for `fun interface` support + new kotlin-fun-interface fixture in the corpus. Drift is both corpus-additive (the fixture) and grammar-driven (the new grammar parses `fun interface` as a class_declaration, not an ERROR node). Baselined to the NEW grammar's fingerprint, so this --check passes only once the regenerated prebuilds land \u2014 until then CI loads the committed 0.3.8 binary and the bench is red, same as the kotlin fun-interface integration tests. scaling ~0.83 (linear).",
|
||||
"_rebaselined_2271": "PR #2271: re-vendored tree-sitter-kotlin 0.3.8 -> unreleased fwcd main c8ac3d26 for `fun interface` support + new kotlin-fun-interface fixture in the corpus. Drift is both corpus-additive (the fixture) and grammar-driven (the new grammar parses `fun interface` as a class_declaration, not an ERROR node). Baselined to the NEW grammar's fingerprint, so this --check passes only once the regenerated prebuilds land — until then CI loads the committed 0.3.8 binary and the bench is red, same as the kotlin fun-interface integration tests. scaling ~0.83 (linear).",
|
||||
"_rebaselined_2522_review_fixes": "PR #2522 review fixes: fieldless assignment nodes decomposed positionally. Prior e856951c2a779163d555dadc8e1bf59304a86caed78ac1f450d9caa2b50f63d1 -> 4b31f46cfb004ba769a96feeb06ae4ef109c77410f54e7aaab4a688df599b112; scaling ratio re-verified within budget.",
|
||||
"_rebaselined_2550_instance_model": "PR #2549 (#2545): anonymous object expressions (object_literal) emit @scope.class, and the kotlin-object-literal-scope fixture joined the corpus. Prior 4b31f46cfb004ba769a96feeb06ae4ef109c77410f54e7aaab4a688df599b112 -> a6fce0dff00e88d41d85023eaf3f35016b5217c7e5225f24a598e4c70bb63091; scaling 0.951 < 1.5.",
|
||||
"_rebaselined_2563_instance_ownership": "#2563: kotlin-instance-ownership adds unrelated, inherited, outer-instance, and anonymous-object coverage. Prior a6fce0dff00e88d41d85023eaf3f35016b5217c7e5225f24a598e4c70bb63091 -> 9f159f8810d342ef1c821f466efd6920dad9a190f06000056e6cd2815861b195; scaling 1.257 < 1.5.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged \u2014 the tag is added to existing call matches, never a new match \u2014 so this is digest drift only. Prior 9f159f8810d342ef1c821f466efd6920dad9a190f06000056e6cd2815861b195 -> d3c4d2fa0d82d248a2299cfc888b067187ad1faf2c87a97f93c6ed835eefc3f1.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|\u2026` instead of `1|\u2026`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior d3c4d2fa0d82d248a2299cfc888b067187ad1faf2c87a97f93c6ed835eefc3f1 -> c1f0cc9058ab11b7cd6fc8b440deb6db2b2f530f2eb21178923e68a3d0796c4b.",
|
||||
"_rebaselined_2766_await_subscript_emission": "#2766: extractMixedChain now walks THROUGH await and subscript nodes and peels transparent wrappers at loop entry, so sites whose receiver is `repos[0]` or `(await f())` mint a receiver chain where they previously minted none. EMISSION CHANGE: more sites carry `@reference.receiver-chain`; no existing chain changed shape. Only go and kotlin drifted of 15 \u2014 the two whose fixture corpora contain such receivers. Prior c1f0cc9058ab11b7cd6fc8b440deb6db2b2f530f2eb21178923e68a3d0796c4b -> efd5dbf80ffcd3bab2834d1010f6fe2b239dcc5d58229938dea9cff8d0f380f2.",
|
||||
"_rebaselined_receiver_chain_2747": "#2747 receiver-chain rollout: call matches whose receiver is itself an expression now carry `@reference.receiver-chain`, a compact encoding of the receiver's structure, so resolution types it by folding instead of re-parsing receiver source text. Capture GROUP counts are unchanged — the tag is added to existing call matches, never a new match — so this is digest drift only. Prior 9f159f8810d342ef1c821f466efd6920dad9a190f06000056e6cd2815861b195 -> d3c4d2fa0d82d248a2299cfc888b067187ad1faf2c87a97f93c6ed835eefc3f1.",
|
||||
"_rebaselined_2766_receiver_chain_wire_v2": "#2766: receiver-chain wire format v1 -> v2 (name-free `await` / `index` step kinds). The VERSION prefix is part of every emitted `@reference.receiver-chain` capture, so every chain-minting language's capture text changed. WIRE-FORMAT CHANGE, NOT A CAPTURE-SET CHANGE: the same chains are minted for the same sites, spelled `2|…` instead of `1|…`. Exactly the 12 chain-minting languages drifted; c, cobol and dart did not, which is the check that this is the prefix and not a capture regression. Accompanied by SCHEMA_BUMP 34 -> 37 and INCREMENTAL_SCHEMA_VERSION 28 -> 31 so a stale index is rejected rather than replaying chains a v2 decoder refuses. Prior d3c4d2fa0d82d248a2299cfc888b067187ad1faf2c87a97f93c6ed835eefc3f1 -> c1f0cc9058ab11b7cd6fc8b440deb6db2b2f530f2eb21178923e68a3d0796c4b.",
|
||||
"_rebaselined_2766_await_subscript_emission": "#2766: extractMixedChain now walks THROUGH await and subscript nodes and peels transparent wrappers at loop entry, so sites whose receiver is `repos[0]` or `(await f())` mint a receiver chain where they previously minted none. EMISSION CHANGE: more sites carry `@reference.receiver-chain`; no existing chain changed shape. Only go and kotlin drifted of 15 — the two whose fixture corpora contain such receivers. Prior c1f0cc9058ab11b7cd6fc8b440deb6db2b2f530f2eb21178923e68a3d0796c4b -> efd5dbf80ffcd3bab2834d1010f6fe2b239dcc5d58229938dea9cff8d0f380f2.",
|
||||
"_rebaselined_2960_declared_package_fixture": "#2960 adds four Kotlin declared-package import-resolution fixture files. This is fixture-corpus growth only: fixture_count 137 -> 141 and capture_groups_fp 2334 -> 2367; the synthetic capture counts remain 4753/15203, no Kotlin scope-capture query or implementation changed, and package resolution runs after capture. Other language fingerprints matched their baselines in the same CI run. Prior a184f8ff0ae40d246db855b63f7ff26bda3afac03e5f4c76e4593c7e2cefce54 -> f98e7e936afbce0e99588285cfc603bf945fd58c5de45271860509a5d90eb832.",
|
||||
"capture_groups_small": 5253,
|
||||
"capture_groups_large": 16803,
|
||||
|
|
@ -288,7 +298,7 @@
|
|||
"fixture_count": 142,
|
||||
"_rebaselined_1432_member_call_callee_name": "#1432 (Zig): the shared callable-flow reader no longer names a callee by simple name for a MEMBER call (`@callable-flow.direct-callee-name` requires a direct designator: `f(x)`, `ns.f(x)`), and a member call is a field-stored-callable invoke only when a MEMBER store (`o.f = handler`) or a declared callable-typed field is visible - a same-named plain binding no longer gates it. CAPTURE-EMISSION CHANGE, not fixture growth (fixture_count unchanged). Only drift: `users.map { it.name }.forEach { name -> println(name) }` (kotlin-lambda-scopes/App.kt) loses `direct-callee-name|forEach` (member call). capture_groups_fp 2334 (unchanged). Prior a184f8ff0ae40d246db855b63f7ff26bda3afac03e5f4c76e4593c7e2cefce54 -> 5a181af0dbc9451937da0964c40d3f3f9820914ca429d873bb5c812b5e2b9284.",
|
||||
"_rebaselined_1432_rebase_onto_2960": "#1432 rebase onto main @ aac7515d: the kotlin fingerprint is a COMBINATION of two independent changes, so neither side of the merge conflict was correct on its own and resolving it by picking a side would have committed a fingerprint no run can reproduce. main's #2960 added four declared-package fixture files (fixture_count 137 -> 141, capture_groups_fp 2334 -> 2367); this branch's `_rebaselined_1432_member_call_callee_name` drops `direct-callee-name|forEach` from one member call. Recomputed under both: capture_groups_fp 2367 and fixture_count 141 match main's committed counts EXACTLY (this branch's change is emission-only and moves no count), capture_groups_small/large stay 4753/15203 (the SYNTHETIC scaling source, which neither change touches), scaling 1.003 < 1.5, and the other 14 languages report ok against their committed baselines in the same run - which is the check that the rebase replayed nothing else into the capture stream. Attribution is exact rather than inferred: moving test/fixtures/lang-resolution/kotlin-import-package-evidence aside and re-running returns kotlin to 5a181af0dbc9451937da0964c40d3f3f9820914ca429d873bb5c812b5e2b9284 byte-for-byte with fixture_count back at 137 and capture_groups_fp back at 2334 - this branch's pre-rebase value - so the whole delta is #2960's corpus growth layered on top, with nothing else moving. Prior (this branch, pre-rebase) 5a181af0dbc9451937da0964c40d3f3f9820914ca429d873bb5c812b5e2b9284 and (main) f98e7e936afbce0e99588285cfc603bf945fd58c5de45271860509a5d90eb832 -> 973d702510002dda76166e017c5eca90cae37a139f5a512877b7a1b04ad19dc5.",
|
||||
"_rebaselined_1432_merge_main_2885": "#1432 merge of main @ 212e007a: the kotlin fingerprint is again a COMBINATION of two independent changes \u2014 main's #2885 JVM property accessors / interface-abstract (4753/15203 -> 5753/18403, capture_groups_fp 2367 -> 2563) and this branch's `_rebaselined_1432_member_call_callee_name` (drops `direct-callee-name|forEach` from one member call). Neither side's value reproduces under the merged tree. Recomputed under both: counts 5753/18403/2563 and fixture_count 141 match main's committed counts EXACTLY (this branch's change is emission-only), scaling 1.061 < 1.5, and csharp / cpp / typescript measure byte-for-byte at this branch's committed values (main did not touch them since the merge-base) while the other 11 languages report ok \u2014 the check that the merge replayed nothing else into the capture stream. Prior (main) aeafc7a87402c933786ef582b7c98683b1822b78fa909e605cb97552867fa0d5 and (this branch) 973d702510002dda76166e017c5eca90cae37a139f5a512877b7a1b04ad19dc5 -> a9d3f0db7547ff47856159debf15d2a6f427efca97a6af27b4004174ed432132.",
|
||||
"_rebaselined_1432_merge_main_2885": "#1432 merge of main @ 212e007a: the kotlin fingerprint is again a COMBINATION of two independent changes — main's #2885 JVM property accessors / interface-abstract (4753/15203 -> 5753/18403, capture_groups_fp 2367 -> 2563) and this branch's `_rebaselined_1432_member_call_callee_name` (drops `direct-callee-name|forEach` from one member call). Neither side's value reproduces under the merged tree. Recomputed under both: counts 5753/18403/2563 and fixture_count 141 match main's committed counts EXACTLY (this branch's change is emission-only), scaling 1.061 < 1.5, and csharp / cpp / typescript measure byte-for-byte at this branch's committed values (main did not touch them since the merge-base) while the other 11 languages report ok — the check that the merge replayed nothing else into the capture stream. Prior (main) aeafc7a87402c933786ef582b7c98683b1822b78fa909e605cb97552867fa0d5 and (this branch) 973d702510002dda76166e017c5eca90cae37a139f5a512877b7a1b04ad19dc5 -> a9d3f0db7547ff47856159debf15d2a6f427efca97a6af27b4004174ed432132.",
|
||||
"_rebaselined_3354_callable_alternatives": "#3354 callable alternatives: a callable chosen by a value-selecting source now flows every branch it can yield (`a ?? b`, `a || b`, `a or b`, `c ? a : b`, statement `if`, elvis), and an operator branch (`x == f || g`) stays opaque instead of seeding a qualified name. Verified by running the BASE (merge-base 233ca2849) and HEAD emitters over the SAME HEAD fixture corpus: every added or removed match is an `@callable-flow.*` match on one of those sources, and the pre-existing corpus is byte-identical (all other languages: zero delta). The rest of the drift is corpus growth from this PR's regression fixture, which this bench globs. Corpus growth: kotlin-callable-alternatives/App.kt (+1 file, +71 groups). Emitter delta: +8 / -2: elvis and `if` expression (bare and braced) seeds and copies now name each operand; the 2 removed matches are the whole-expression seed and copy carrying a qualified name of the compound source; the multi-statement `if` stays opaque. capture_groups_fp 2563 -> 2634, fixture_count 141 -> 142; synthetic counts unchanged; scaling 1.17 < 1.5. Prior a9d3f0db7547ff47856159debf15d2a6f427efca97a6af27b4004174ed432132 -> f3fefe058484823761b52df5715f41d65fa4ff0223843bcc86893d7b0a6b3de2.",
|
||||
"_rebaselined_3486_semantic_rename": "#3486: Compared actual origin/main (191a954b), committed dd3bf and frozen provider source over the same unchanged corpus. 1 existing member-read match gains a receiver-chain tag; removing only that added tag restores the complete main capture set. No group is added or removed. Fixture entries 142; changed entries 1; capture groups 2634 -> 2634. Fingerprint regenerated from the runner's canonicalized capture records. Scaling budgets unchanged."
|
||||
},
|
||||
|
|
@ -296,6 +306,6 @@
|
|||
"_lexical_ownership_3532": "#3532: lexical ownership captures and fixture updates; fixture identities are relative to lang-resolution so serialized scope IDs are independent of checkout location. Full capture content remains hashed; scaling_budget is unchanged.",
|
||||
"fingerprint": "3f41a3c6d9161f95c0c906cc979e6ef853c25b39052c5cab274dba2aabf270ba",
|
||||
"scaling_budget": 1.5,
|
||||
"_added": "#3354 review: one TS `handler || w === \"k0\" || \u2026` chain, operand count = entity count (250 -> 800). Guards callable-flow value-alternative expansion (valueAlternatives + per-leaf visibility walks) against per-leaf cost that grows with chain depth: before the fix this measured 7.5-8.0 (super-linear; 8000 operands overflowed the stack), after it 1.11-1.22. Synthetic-only fingerprint (no fixture corpus); identical before and after the fix."
|
||||
"_added": "#3354 review: one TS `handler || w === \"k0\" || …` chain, operand count = entity count (250 -> 800). Guards callable-flow value-alternative expansion (valueAlternatives + per-leaf visibility walks) against per-leaf cost that grows with chain depth: before the fix this measured 7.5-8.0 (super-linear; 8000 operands overflowed the stack), after it 1.11-1.22. Synthetic-only fingerprint (no fixture corpus); identical before and after the fix."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"_what": "Baselines for bench/swift-package-imports/measure.mjs --check. Guards Swift Package.swift declaration resolve after #2964 / #2931: declared-target hits, SDK and undeclared-folder misses, empty declaredTargets fail-closed, @_exported union, #2931 nested-prefix membership, first-wins grouping, and https:// factory survival. Same approach as bench/parse-dispatch-rounds/baselines.json — exact floors and a fingerprint first; the only timing arms are ratios.",
|
||||
|
||||
"_triage": "READ THIS BEFORE RE-RUNNING. targets, files, imports, declared_resolved, sdk_external, undeclared_external, empty_declared_external, reexport_extra, nested_repeat_resolved, first_wins, parse_targets, parse_binary_skipped, url_comment_targets, parse_complete and layout_fingerprint are DETERMINISTIC: a re-run never changes them, and none may be re-baselined to make CI green. resolve_scaling_ratio, strategy_scaling_ratio and parse_scaling_ratio are the only timing arms; runner contention dominates them, so re-run on an idle machine before investigating and read the reported `reps` first. If exactly one arm fails and it is a timing arm, suspect the machine.",
|
||||
"_triage": "READ THIS BEFORE RE-RUNNING. targets, files, imports, declared_resolved, sdk_external, undeclared_external, empty_declared_external, reexport_extra, nested_repeat_resolved, first_wins, parse_targets, parse_binary_skipped, url_comment_targets, parse_complete and layout_fingerprint are DETERMINISTIC: a re-run never changes them, and none may be re-baselined to make CI green. resolve_scaling_ratio and parse_scaling_ratio are the only timing arms; runner contention dominates them, so re-run on an idle machine before investigating and read the reported `reps` first. If exactly one arm fails and it is a timing arm, suspect the machine.",
|
||||
|
||||
"targets": 16,
|
||||
"files": 260,
|
||||
|
|
@ -27,23 +27,17 @@
|
|||
"_layout_fingerprint_note": "sha256 over sorted from|target->files rows on the unique query set. A change here is a BEHAVIOUR change — the resolver returned a different target set. Explain it, never re-baseline it alone.",
|
||||
|
||||
"resolve_scaling_budget": 1.9,
|
||||
"strategy_scaling_budget": 1.6,
|
||||
"parse_scaling_budget": 1.9,
|
||||
"_resolve_scaling_note": "(t_4n / t_n) / 4 for resolveSwiftImportTarget over the declared corpus; ~1.0 is linear. A RATIO rather than a millisecond ceiling, deliberately: wall-clock is runner-speed-dependent, and this repo has already been bitten by a fixed ms budget. A per-import allFilePaths scan scores ~4. Budget is 1.9, i.e. 1.51x the measured maximum 1.261 — this file's siblings use ~1.5x on ratios. min-of-15 estimator.",
|
||||
"_strategy_scaling_note": "(t_4n / t_n) / 4 for swiftPackageStrategy (the import-config WeakMap index). Measured maximum 1.030; budget 1.6 is 1.55x, matching parse-dispatch-rounds' pack_scaling_budget.",
|
||||
"_parse_scaling_note": "(t_4n / t_n) / 4 for parseSwiftPackageManifest over 256 vs 1024 factories. Measured maximum 1.276; budget 1.9 is 1.49x. The small cell is still sub-millisecond, so this budget is looser than strategy on purpose.",
|
||||
"_parse_scaling_note": "(t_4n / t_n) / 4 for parseSwiftPackageManifest over 256 vs 1024 factories. Measured maximum 1.276; budget 1.9 is 1.49x. The small cell is still sub-millisecond, so the budget allows timing variance.",
|
||||
|
||||
"_measured": {
|
||||
"resolve_scaling_ratio": 1.261,
|
||||
"resolve_scaling_ratio_samples": [1.261, 1.201, 1.182, 1.241, 1.212],
|
||||
"strategy_scaling_ratio": 1.03,
|
||||
"strategy_scaling_ratio_samples": [1.019, 0.994, 0.97, 1.015, 1.03],
|
||||
"parse_scaling_ratio": 1.276,
|
||||
"parse_scaling_ratio_samples": [1.25, 1.276, 1.215, 1.224, 1.227],
|
||||
"resolve_ms": 3.5,
|
||||
"resolve_ms_4x": 17.16,
|
||||
"strategy_ms": 0.67,
|
||||
"strategy_ms_4x": 2.65,
|
||||
"parse_ms": 0.41,
|
||||
"parse_ms_4x": 2.01,
|
||||
"reps": 15
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
* rows on the unique query set. Catches a target-set change that leaves
|
||||
* the counts intact.
|
||||
*
|
||||
* - `resolve_scaling_ratio` / `strategy_scaling_ratio` / `parse_scaling_ratio`
|
||||
* - `resolve_scaling_ratio` / `parse_scaling_ratio`
|
||||
* — the only timing arms, RATIOS not millisecond ceilings.
|
||||
* `(t_4n / t_n) / 4` divides the machine out; ~1.0 is linear.
|
||||
* Files-per-target is FIXED while target count (and therefore files and
|
||||
|
|
@ -54,7 +54,6 @@ import { createHash } from 'node:crypto';
|
|||
import { readFileSync } from 'node:fs';
|
||||
import { performance } from 'node:perf_hooks';
|
||||
import { parseSwiftPackageManifest } from '../../src/core/ingestion/language-config.ts';
|
||||
import { swiftPackageStrategy } from '../../src/core/ingestion/import-resolvers/configs/swift.ts';
|
||||
import { resolveSwiftImportTarget } from '../../src/core/ingestion/languages/swift/import-target.ts';
|
||||
import { groupSwiftFilesByModule } from '../../src/core/ingestion/languages/swift/target-grouping.ts';
|
||||
|
||||
|
|
@ -173,23 +172,6 @@ function resolveOne(query, allFilePaths, config, parsedFiles) {
|
|||
});
|
||||
}
|
||||
|
||||
function strategyCtx(files, config) {
|
||||
return {
|
||||
allFilePaths: new Set(files),
|
||||
allFileList: files,
|
||||
normalizedFileList: files.map((p) => p.replace(/\\/g, '/')),
|
||||
index: {},
|
||||
resolveCache: new Map(),
|
||||
configs: {
|
||||
tsconfigPaths: null,
|
||||
goModule: null,
|
||||
composerConfig: null,
|
||||
swiftPackageConfig: config,
|
||||
csharpConfigs: [],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function resolvePass(corpus) {
|
||||
const allFilePaths = new Set(corpus.files);
|
||||
let resolved = 0;
|
||||
|
|
@ -199,15 +181,6 @@ function resolvePass(corpus) {
|
|||
return resolved;
|
||||
}
|
||||
|
||||
function strategyPass(corpus) {
|
||||
const ctx = strategyCtx(corpus.files, corpus.config);
|
||||
let resolved = 0;
|
||||
for (const query of corpus.queries) {
|
||||
if (swiftPackageStrategy(query.raw, query.from, ctx) != null) resolved++;
|
||||
}
|
||||
return resolved;
|
||||
}
|
||||
|
||||
function manifestFor(targetCount) {
|
||||
const rows = [];
|
||||
for (let i = 0; i < targetCount; i++) {
|
||||
|
|
@ -327,10 +300,6 @@ const smallResolveMs = fastest(() => resolvePass(small), REPS);
|
|||
const largeResolveMs = fastest(() => resolvePass(large), REPS);
|
||||
const resolveScaling = largeResolveMs / smallResolveMs / SCALE;
|
||||
|
||||
const smallStrategyMs = fastest(() => strategyPass(small), REPS);
|
||||
const largeStrategyMs = fastest(() => strategyPass(large), REPS);
|
||||
const strategyScaling = largeStrategyMs / smallStrategyMs / SCALE;
|
||||
|
||||
const parseSmallSrc = manifestFor(PARSE_TARGETS);
|
||||
const parseLargeSrc = manifestFor(PARSE_TARGETS * SCALE);
|
||||
const parseSmall = parseSwiftPackageManifest(parseSmallSrc);
|
||||
|
|
@ -376,14 +345,11 @@ console.log(`layout_fingerprint : ${shape.fingerprint}`);
|
|||
console.log(
|
||||
`resolve_scaling_ratio : ${resolveScaling.toFixed(3)} (budget <= ${baselines.resolve_scaling_budget}; ~1.0 is linear)`,
|
||||
);
|
||||
console.log(
|
||||
`strategy_scaling_ratio : ${strategyScaling.toFixed(3)} (budget <= ${baselines.strategy_scaling_budget}; ~1.0 is linear)`,
|
||||
);
|
||||
console.log(
|
||||
`parse_scaling_ratio : ${parseScaling.toFixed(3)} (budget <= ${baselines.parse_scaling_budget}; ~1.0 is linear)`,
|
||||
);
|
||||
console.log(
|
||||
`reps : ${REPS} resolve ${smallResolveMs.toFixed(2)}ms / 4x ${largeResolveMs.toFixed(2)}ms strategy ${smallStrategyMs.toFixed(2)}ms / 4x ${largeStrategyMs.toFixed(2)}ms parse ${smallParseMs.toFixed(2)}ms / 4x ${largeParseMs.toFixed(2)}ms`,
|
||||
`reps : ${REPS} resolve ${smallResolveMs.toFixed(2)}ms / 4x ${largeResolveMs.toFixed(2)}ms parse ${smallParseMs.toFixed(2)}ms / 4x ${largeParseMs.toFixed(2)}ms`,
|
||||
);
|
||||
console.log(
|
||||
`parse_scale_shape : ${parseSmall.targets.size} -> ${parseLarge.targets.size} targets (expect ${PARSE_TARGETS} -> ${PARSE_TARGETS * SCALE})`,
|
||||
|
|
@ -457,16 +423,6 @@ if (process.argv.includes('--check')) {
|
|||
);
|
||||
}
|
||||
|
||||
if (strategyScaling > baselines.strategy_scaling_budget) {
|
||||
failed = true;
|
||||
console.error(
|
||||
`\nFAIL strategy_scaling_ratio: ${strategyScaling.toFixed(3)} exceeds ` +
|
||||
`${baselines.strategy_scaling_budget} (~1.0 is linear).\n` +
|
||||
` swiftPackageStrategy grew superlinearly — usually the WeakMap target\n` +
|
||||
` index falling back to O(imports × files). Re-run idle; check \`reps\`.`,
|
||||
);
|
||||
}
|
||||
|
||||
if (parseScaling > baselines.parse_scaling_budget) {
|
||||
failed = true;
|
||||
console.error(
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import type { HttpDetection, HttpLanguagePlugin } from './types.js';
|
|||
* `python-const-resolver.ts` / `js-const-resolver.ts`). PHP has no such
|
||||
* binding yet — adding one is a real, separate project (this repo's PHP
|
||||
* import resolution for `use`-statements is its own multi-file subsystem
|
||||
* under `ingestion/import-resolvers/php.ts`, built for symbol/scope
|
||||
* under `ingestion/languages/php/import-helpers.ts`, built for symbol/scope
|
||||
* resolution, not constant extraction) and is intentionally out of scope
|
||||
* here. Tracked as a follow-up, not silently punted.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ try {
|
|||
import type { ContractExtractor, CypherExecutor } from '../contract-extractor.js';
|
||||
import type { ExtractedContract, RepoHandle } from '../types.js';
|
||||
import { readSafe } from './fs-utils.js';
|
||||
import { buildSuffixIndex, type SuffixIndex } from '../../ingestion/import-resolvers/utils.js';
|
||||
import { buildSuffixIndex, type SuffixIndex } from '../../ingestion/utils/suffix-index.js';
|
||||
import { createIgnoreFilter } from '../../../config/ignore-service.js';
|
||||
import { getMaxFileSizeBytes } from '../../ingestion/utils/max-file-size.js';
|
||||
import { parseSourceSafe } from '../../tree-sitter/safe-parse.js';
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ import path from 'node:path';
|
|||
import { brokerForBindingKey, brokerForProtocol, isNonDestinationBroker } from './protocol.js';
|
||||
|
||||
// `js-yaml` is CJS; the rest of this repository reaches it the same way
|
||||
// (`pipeline-phases/spring-config.ts`, `import-resolvers/node-workspace-packages.ts`).
|
||||
// (`pipeline-phases/spring-config.ts`, `languages/typescript/workspace-packages.ts`).
|
||||
const _require = createRequire(import.meta.url);
|
||||
const yaml = _require('js-yaml') as typeof import('js-yaml');
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@
|
|||
* consumers of the registry read them off its results; `DiResolver` is not
|
||||
* re-exported, since only implementations need it and they import it from here
|
||||
* directly.
|
||||
*
|
||||
* Mirrors the `import-resolvers/types.ts` split of contract from registry.
|
||||
*/
|
||||
|
||||
import type { GraphNode } from 'gitnexus-shared';
|
||||
|
|
|
|||
|
|
@ -2,11 +2,36 @@
|
|||
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import type { FieldExtractionConfig } from '../generic.js';
|
||||
import type { SyntaxNode } from '../../utils/ast-helpers.js';
|
||||
import { hasKeyword, findVisibility, typeFromAnnotation } from './helpers.js';
|
||||
import type { FieldVisibility } from '../../field-types.js';
|
||||
|
||||
const VISIBILITY_KEYWORDS = new Set<FieldVisibility>(['public', 'private', 'protected']);
|
||||
|
||||
/**
|
||||
* The class a field's initializer constructs: `static DEFAULT = new Config()`
|
||||
* -> `Config`, `repo = new models.Repo()` -> `models.Repo`. `undefined` for any
|
||||
* other initializer — a literal, a call, a missing one.
|
||||
*
|
||||
* The same two constructor shapes (identifier, member expression) the JS and TS
|
||||
* scope queries bind a class field from (`@type-binding.constructor`). Those
|
||||
* bindings live in the CLASS scope, which has one map for static and instance
|
||||
* members, so a static field's binding is dropped there to keep it from
|
||||
* retyping an instance field of the same name (`isStaticClassFieldBinding`).
|
||||
* Recorded on the field instead, the static field keeps its type on its own
|
||||
* Property node, where nothing else can collide with it.
|
||||
*/
|
||||
export function constructedTypeOfFieldInitializer(node: SyntaxNode): string | undefined {
|
||||
const value = node.childForFieldName('value');
|
||||
if (value === null || value.type !== 'new_expression') return undefined;
|
||||
const constructorNode = value.childForFieldName('constructor');
|
||||
if (constructorNode === null) return undefined;
|
||||
if (constructorNode.type !== 'identifier' && constructorNode.type !== 'member_expression') {
|
||||
return undefined;
|
||||
}
|
||||
return constructorNode.text;
|
||||
}
|
||||
|
||||
const shared: Omit<FieldExtractionConfig, 'language'> = {
|
||||
typeDeclarationNodes: [
|
||||
'class_declaration',
|
||||
|
|
@ -35,6 +60,8 @@ const shared: Omit<FieldExtractionConfig, 'language'> = {
|
|||
return typeFromAnnotation(node);
|
||||
},
|
||||
|
||||
extractInitializerType: constructedTypeOfFieldInitializer,
|
||||
|
||||
extractVisibility(node) {
|
||||
// TypeScript accessibility_modifier
|
||||
for (let i = 0; i < node.namedChildCount; i++) {
|
||||
|
|
|
|||
|
|
@ -58,6 +58,13 @@ export interface FieldExtractionConfig {
|
|||
* `normalizeType`/`resolveType` entirely — it is the untouched source text.
|
||||
*/
|
||||
extractRawType?: (node: SyntaxNode) => string | undefined;
|
||||
/**
|
||||
* Extract the type a field's initializer constructs (`= new Config()` ->
|
||||
* `Config`). Consulted only when `extractType` found no declared type, so it
|
||||
* can never stand in for one. Optional — only languages whose fields can be
|
||||
* typed by their initializer alone implement it.
|
||||
*/
|
||||
extractInitializerType?: (node: SyntaxNode) => string | undefined;
|
||||
/**
|
||||
* Extract `'@Name'`-prefixed annotation names from a field declaration
|
||||
* node (e.g. `['@Autowired']`). Optional — only languages with
|
||||
|
|
@ -232,16 +239,27 @@ export function createFieldExtractor(config: FieldExtractionConfig): FieldExtrac
|
|||
annotations = undefined;
|
||||
}
|
||||
|
||||
let initializerType: string | undefined;
|
||||
try {
|
||||
initializerType = type === null ? config.extractInitializerType?.(node) : undefined;
|
||||
} catch {
|
||||
// Same group-drop rationale as the extractRawType guard above —
|
||||
// degrade to a field without an initializer type.
|
||||
initializerType = undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
name,
|
||||
type,
|
||||
...(rawDeclaredType !== undefined ? { rawDeclaredType } : {}),
|
||||
...(initializerType !== undefined ? { initializerType } : {}),
|
||||
...(annotations !== undefined && annotations.length > 0 ? { annotations } : {}),
|
||||
visibility: config.extractVisibilityForName?.(node, name) ?? config.extractVisibility(node),
|
||||
isStatic: config.isStatic(node),
|
||||
isReadonly: config.isReadonly(node),
|
||||
sourceFile: context.filePath,
|
||||
line: node.startPosition.row + 1,
|
||||
column: node.startPosition.column,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
import type { SyntaxNode } from '../utils/ast-helpers.js';
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import { BaseFieldExtractor } from '../field-extractor.js';
|
||||
import { constructedTypeOfFieldInitializer } from './configs/typescript-javascript.js';
|
||||
import type {
|
||||
FieldExtractorContext,
|
||||
ExtractedFields,
|
||||
|
|
@ -177,14 +178,18 @@ export class TypeScriptFieldExtractor extends BaseFieldExtractor {
|
|||
type = resolvedType ?? type;
|
||||
}
|
||||
|
||||
const initializerType = type === null ? constructedTypeOfFieldInitializer(node) : undefined;
|
||||
|
||||
return {
|
||||
name,
|
||||
type,
|
||||
...(initializerType !== undefined ? { initializerType } : {}),
|
||||
visibility: this.extractVisibility(node),
|
||||
isStatic: this.isStatic(node),
|
||||
isReadonly: this.isReadonly(node),
|
||||
sourceFile: context.filePath,
|
||||
line: node.startPosition.row + 1,
|
||||
column: node.startPosition.column,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,13 @@ export interface FieldInfo {
|
|||
* Never passes through simple-name extraction or type resolution.
|
||||
*/
|
||||
rawDeclaredType?: string;
|
||||
/**
|
||||
* The type the field's INITIALIZER constructs, recorded only for a field that
|
||||
* declares no type (`static DEFAULT = new Config()` -> `Config`). Omitted when
|
||||
* `type` is set, when the initializer constructs nothing nameable, and for
|
||||
* every language whose config does not read initializers.
|
||||
*/
|
||||
initializerType?: string;
|
||||
/**
|
||||
* Annotation names found on the field declaration, `'@Name'`-prefixed
|
||||
* (e.g. `['@Autowired']`), matching the method-extractor convention.
|
||||
|
|
@ -56,6 +63,8 @@ export interface FieldInfo {
|
|||
sourceFile: string;
|
||||
/** Line number */
|
||||
line: number;
|
||||
/** Zero-based declaration column, when the extractor has an AST position. */
|
||||
column?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ export function finalizeScopeModel(
|
|||
namespaceFqnBindings: new Map(),
|
||||
namespaceTypeBindings: new Map(),
|
||||
accessibleNamespacesByScope: new Map(),
|
||||
namespaceLookupTiersByScope: new Map(),
|
||||
referenceSites: Object.freeze([...allReferenceSites]),
|
||||
sccs: finalizeOut.sccs,
|
||||
stats: finalizeOut.stats,
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
/**
|
||||
* C / C++ import resolution configs.
|
||||
* Both use standard resolution for #include directives.
|
||||
*/
|
||||
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import type { ImportResolutionConfig } from '../types.js';
|
||||
import { createStandardStrategy } from '../standard.js';
|
||||
|
||||
export const cImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.C,
|
||||
strategies: [createStandardStrategy(SupportedLanguages.C)],
|
||||
};
|
||||
|
||||
export const cppImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.CPlusPlus,
|
||||
strategies: [createStandardStrategy(SupportedLanguages.CPlusPlus)],
|
||||
};
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
/**
|
||||
* C# import resolution config.
|
||||
* Namespace-based strategy via .csproj configs, then standard fallback.
|
||||
*/
|
||||
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
||||
import { createStandardStrategy } from '../standard.js';
|
||||
import { resolveCSharpImportInternal, resolveCSharpNamespaceDir } from '../csharp.js';
|
||||
import { csharpSuffixFallbackAllowed } from '../../csharp-namespace-gate.js';
|
||||
|
||||
/** C# namespace-based resolution strategy via .csproj configs. */
|
||||
export const csharpNamespaceStrategy: ImportResolverStrategy = (rawImportPath, _filePath, ctx) => {
|
||||
const csharpConfigs = ctx.configs.csharpConfigs;
|
||||
const evidence = ctx.configs.csharpNamespaces;
|
||||
if (csharpConfigs.length === 0) {
|
||||
// No csproj → there's no namespace→directory mapping to apply, so the
|
||||
// generic strategy would normally take over. But that generic suffix match
|
||||
// is UNGATED: it re-introduces the BCL→local spurious match the #1881 gate
|
||||
// exists to stop. Mirror the registry leg's no-csproj path — defer to the
|
||||
// generic strategy ONLY for imports that align with an in-repo declared
|
||||
// namespace; for everything else (BCL usings) return an authoritative empty
|
||||
// result that STOPS the chain (#2 parity). With no evidence threaded the
|
||||
// gate fails open, so behavior is unchanged when the scan didn't run.
|
||||
if (!csharpSuffixFallbackAllowed(rawImportPath, evidence)) {
|
||||
return { kind: 'files', files: [] };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
const resolvedFiles = resolveCSharpImportInternal(
|
||||
rawImportPath,
|
||||
csharpConfigs,
|
||||
// The Set, not `ctx.normalizedFileList`/`ctx.allFileList`: the resolver
|
||||
// derives both from it through the same per-pass memo the ctx's own arrays
|
||||
// come from, so this is the identical pair by a shorter route.
|
||||
ctx.allFilePaths,
|
||||
ctx.index,
|
||||
evidence,
|
||||
);
|
||||
if (resolvedFiles.length > 1) {
|
||||
const dirSuffix = resolveCSharpNamespaceDir(rawImportPath, csharpConfigs);
|
||||
if (dirSuffix) {
|
||||
return { kind: 'package', files: resolvedFiles, dirSuffix };
|
||||
}
|
||||
}
|
||||
// Authoritative once csproj configs exist: return even an empty result to
|
||||
// STOP the chain, so the generic suffix fallback can't re-introduce the
|
||||
// gated BCL→local match this resolver just suppressed (#1881).
|
||||
return { kind: 'files', files: resolvedFiles };
|
||||
};
|
||||
|
||||
export const csharpImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.CSharp,
|
||||
strategies: [csharpNamespaceStrategy, createStandardStrategy(SupportedLanguages.CSharp)],
|
||||
};
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/**
|
||||
* Dart import resolution config.
|
||||
* SDK/package strategy first, then relative import strategy (with ./ prepending).
|
||||
*/
|
||||
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
||||
import { resolveStandard } from '../standard.js';
|
||||
|
||||
/**
|
||||
* Dart SDK and package: import strategy.
|
||||
* Absorbs dart: SDK imports and external packages (returns empty result to stop chain).
|
||||
* Returns null for relative imports to let the next strategy handle them.
|
||||
*/
|
||||
export const dartPackageStrategy: ImportResolverStrategy = (rawImportPath, _filePath, ctx) => {
|
||||
// Strip surrounding quotes from configurable_uri capture
|
||||
const stripped = rawImportPath.replace(/^['"]|['"]$/g, '');
|
||||
|
||||
// Skip dart: SDK imports (dart:async, dart:io, etc.)
|
||||
if (stripped.startsWith('dart:')) return { kind: 'files', files: [] };
|
||||
|
||||
// Local package: imports → resolve to lib/<path>
|
||||
if (stripped.startsWith('package:')) {
|
||||
const slashIdx = stripped.indexOf('/');
|
||||
if (slashIdx === -1) return { kind: 'files', files: [] };
|
||||
const relPath = stripped.slice(slashIdx + 1);
|
||||
const candidates = [`lib/${relPath}`, relPath];
|
||||
const files: string[] = [];
|
||||
for (const candidate of candidates) {
|
||||
for (const fp of ctx.allFileList) {
|
||||
if (fp.endsWith('/' + candidate) || fp === candidate) {
|
||||
files.push(fp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (files.length > 0) break;
|
||||
}
|
||||
if (files.length > 0) return { kind: 'files', files };
|
||||
return { kind: 'files', files: [] }; // external package
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Dart relative import strategy — prepends "./" for bare relative paths,
|
||||
* then delegates to standard resolution.
|
||||
*/
|
||||
export const dartRelativeStrategy: ImportResolverStrategy = (rawImportPath, filePath, ctx) => {
|
||||
const stripped = rawImportPath.replace(/^['"]|['"]$/g, '');
|
||||
const relPath = stripped.startsWith('.') ? stripped : './' + stripped;
|
||||
return resolveStandard(relPath, filePath, ctx, SupportedLanguages.Dart);
|
||||
};
|
||||
|
||||
export const dartImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.Dart,
|
||||
strategies: [dartPackageStrategy, dartRelativeStrategy],
|
||||
};
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
/**
|
||||
* Go import resolution config.
|
||||
* Go-specific package strategy (go.mod), then standard fallback.
|
||||
*/
|
||||
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
||||
import { createStandardStrategy } from '../standard.js';
|
||||
import { resolveGoPackageDir, resolveGoPackage } from '../go.js';
|
||||
|
||||
/** Go-specific package resolution strategy — resolves go.mod-based package imports. */
|
||||
export const goPackageStrategy: ImportResolverStrategy = (rawImportPath, _filePath, ctx) => {
|
||||
const goModule = ctx.configs.goModule;
|
||||
if (goModule && rawImportPath.startsWith(goModule.modulePath)) {
|
||||
const pkgSuffix = resolveGoPackageDir(rawImportPath, goModule);
|
||||
if (pkgSuffix) {
|
||||
const pkgFiles = resolveGoPackage(
|
||||
rawImportPath,
|
||||
goModule,
|
||||
ctx.normalizedFileList,
|
||||
ctx.allFileList,
|
||||
);
|
||||
if (pkgFiles.length > 0) {
|
||||
return { kind: 'package', files: pkgFiles, dirSuffix: pkgSuffix };
|
||||
}
|
||||
}
|
||||
// Fall through if no files found (package might be external)
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
export const goImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.Go,
|
||||
strategies: [goPackageStrategy, createStandardStrategy(SupportedLanguages.Go)],
|
||||
};
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
/**
|
||||
* Java / Kotlin import resolution configs.
|
||||
* JVM-specific wildcard/member strategy, then standard fallback.
|
||||
*/
|
||||
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
||||
import { createStandardStrategy } from '../standard.js';
|
||||
import { resolveJvmWildcard, resolveJvmMemberImport, KOTLIN_EXTENSIONS } from '../jvm.js';
|
||||
|
||||
/** Java JVM resolution strategy — wildcard and member import resolution. */
|
||||
export const javaJvmStrategy: ImportResolverStrategy = (rawImportPath, _filePath, ctx) => {
|
||||
if (rawImportPath.endsWith('.*')) {
|
||||
const matchedFiles = resolveJvmWildcard(
|
||||
rawImportPath,
|
||||
ctx.normalizedFileList,
|
||||
ctx.allFileList,
|
||||
['.java'],
|
||||
ctx.index,
|
||||
);
|
||||
if (matchedFiles.length > 0) return { kind: 'files', files: matchedFiles };
|
||||
} else {
|
||||
const memberResolved = resolveJvmMemberImport(
|
||||
rawImportPath,
|
||||
ctx.normalizedFileList,
|
||||
ctx.allFileList,
|
||||
['.java'],
|
||||
ctx.index,
|
||||
);
|
||||
if (memberResolved) return { kind: 'files', files: [memberResolved] };
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Kotlin JVM resolution strategy — wildcard/member with Java-interop + top-level function imports.
|
||||
*/
|
||||
export const kotlinJvmStrategy: ImportResolverStrategy = (rawImportPath, _filePath, ctx) => {
|
||||
if (rawImportPath.endsWith('.*')) {
|
||||
const matchedFiles = resolveJvmWildcard(
|
||||
rawImportPath,
|
||||
ctx.normalizedFileList,
|
||||
ctx.allFileList,
|
||||
KOTLIN_EXTENSIONS,
|
||||
ctx.index,
|
||||
);
|
||||
if (matchedFiles.length === 0) {
|
||||
const javaMatches = resolveJvmWildcard(
|
||||
rawImportPath,
|
||||
ctx.normalizedFileList,
|
||||
ctx.allFileList,
|
||||
['.java'],
|
||||
ctx.index,
|
||||
);
|
||||
if (javaMatches.length > 0) return { kind: 'files', files: javaMatches };
|
||||
}
|
||||
if (matchedFiles.length > 0) return { kind: 'files', files: matchedFiles };
|
||||
} else {
|
||||
let memberResolved = resolveJvmMemberImport(
|
||||
rawImportPath,
|
||||
ctx.normalizedFileList,
|
||||
ctx.allFileList,
|
||||
KOTLIN_EXTENSIONS,
|
||||
ctx.index,
|
||||
);
|
||||
if (!memberResolved) {
|
||||
memberResolved = resolveJvmMemberImport(
|
||||
rawImportPath,
|
||||
ctx.normalizedFileList,
|
||||
ctx.allFileList,
|
||||
['.java'],
|
||||
ctx.index,
|
||||
);
|
||||
}
|
||||
if (memberResolved) return { kind: 'files', files: [memberResolved] };
|
||||
|
||||
// Kotlin: top-level function imports (e.g. import models.getUser) have only 2 segments,
|
||||
// which resolveJvmMemberImport skips (requires >=3). Fall back to package-directory scan
|
||||
// for lowercase last segments (function/property imports). Uppercase last segments
|
||||
// (class imports like models.User) fall through to standard suffix resolution.
|
||||
const segments = rawImportPath.split('.');
|
||||
const lastSeg = segments[segments.length - 1];
|
||||
if (segments.length >= 2 && lastSeg[0] && lastSeg[0] === lastSeg[0].toLowerCase()) {
|
||||
const pkgWildcard = segments.slice(0, -1).join('.') + '.*';
|
||||
let dirFiles = resolveJvmWildcard(
|
||||
pkgWildcard,
|
||||
ctx.normalizedFileList,
|
||||
ctx.allFileList,
|
||||
KOTLIN_EXTENSIONS,
|
||||
ctx.index,
|
||||
);
|
||||
if (dirFiles.length === 0) {
|
||||
dirFiles = resolveJvmWildcard(
|
||||
pkgWildcard,
|
||||
ctx.normalizedFileList,
|
||||
ctx.allFileList,
|
||||
['.java'],
|
||||
ctx.index,
|
||||
);
|
||||
}
|
||||
if (dirFiles.length > 0) return { kind: 'files', files: dirFiles };
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
export const javaImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.Java,
|
||||
strategies: [javaJvmStrategy, createStandardStrategy(SupportedLanguages.Java)],
|
||||
};
|
||||
|
||||
export const kotlinImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.Kotlin,
|
||||
strategies: [kotlinJvmStrategy, createStandardStrategy(SupportedLanguages.Kotlin)],
|
||||
};
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
/**
|
||||
* PHP import resolution config.
|
||||
* PSR-4 strategy via composer.json — no standard fallback (PSR-4 includes its own suffix matching).
|
||||
*/
|
||||
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
||||
import { resolvePhpImportInternal } from '../php.js';
|
||||
|
||||
/** PHP PSR-4 resolution strategy via composer.json autoload mappings. */
|
||||
export const phpPsr4Strategy: ImportResolverStrategy = (rawImportPath, _filePath, ctx) => {
|
||||
const resolved = resolvePhpImportInternal(
|
||||
rawImportPath,
|
||||
ctx.configs.composerConfig,
|
||||
ctx.allFilePaths,
|
||||
ctx.normalizedFileList,
|
||||
ctx.allFileList,
|
||||
ctx.index,
|
||||
);
|
||||
return resolved ? { kind: 'files', files: [resolved] } : null;
|
||||
};
|
||||
|
||||
export const phpImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.PHP,
|
||||
strategies: [phpPsr4Strategy],
|
||||
};
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
/**
|
||||
* Python import resolution config.
|
||||
* PEP 328 relative + proximity-based strategy, then standard fallback.
|
||||
*/
|
||||
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
||||
import { createStandardStrategy } from '../standard.js';
|
||||
import { resolvePythonImportInternal } from '../python.js';
|
||||
|
||||
/**
|
||||
* Python import resolution strategy — PEP 328 relative + proximity-based bare imports.
|
||||
* Returns null to continue chain for non-relative imports.
|
||||
* Absorbs unresolved relative imports (returns empty result to stop the chain).
|
||||
*/
|
||||
export const pythonImportStrategy: ImportResolverStrategy = (rawImportPath, filePath, ctx) => {
|
||||
const resolved = resolvePythonImportInternal(filePath, rawImportPath, ctx.allFilePaths);
|
||||
if (resolved) {
|
||||
ctx.resolveCache.set(`${filePath}::${rawImportPath}`, resolved);
|
||||
return { kind: 'files', files: [resolved] };
|
||||
}
|
||||
// PEP 328: unresolved relative imports should not fall through to suffix matching
|
||||
if (rawImportPath.startsWith('.')) return { kind: 'files', files: [] };
|
||||
|
||||
// External dotted imports like `django.apps` should not fall through to generic
|
||||
// suffix matching when the repo has unrelated local files such as `accounts/apps.py`.
|
||||
// Keep suffix fallback only when the leading segment appears somewhere in-repo,
|
||||
// which preserves existing internal absolute-import behavior like `accounts.models`.
|
||||
const pathLike = rawImportPath.replace(/\./g, '/');
|
||||
if (pathLike.includes('/')) {
|
||||
const [leadingSegment] = pathLike.split('/').filter(Boolean);
|
||||
const hasRepoCandidate =
|
||||
!!leadingSegment &&
|
||||
(ctx.index.get(`${leadingSegment}.py`) !== undefined ||
|
||||
ctx.index.get(`${leadingSegment}/__init__.py`) !== undefined ||
|
||||
ctx.index.getFilesInDir(leadingSegment, '.py').length > 0);
|
||||
|
||||
if (!hasRepoCandidate) return { kind: 'files', files: [] };
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export const pythonImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.Python,
|
||||
strategies: [pythonImportStrategy, createStandardStrategy(SupportedLanguages.Python)],
|
||||
};
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
/**
|
||||
* Ruby import resolution config.
|
||||
* Require/require_relative suffix matching — no standard fallback.
|
||||
*/
|
||||
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
||||
import { suffixResolve } from '../utils.js';
|
||||
|
||||
/** Ruby require/require_relative resolution strategy. */
|
||||
export const rubyRequireStrategy: ImportResolverStrategy = (rawImportPath, _filePath, ctx) => {
|
||||
const pathParts = rawImportPath.replace(/^\.\//, '').split('/').filter(Boolean);
|
||||
const resolved = suffixResolve(pathParts, ctx.normalizedFileList, ctx.allFileList, ctx.index);
|
||||
return resolved ? { kind: 'files', files: [resolved] } : null;
|
||||
};
|
||||
|
||||
export const rubyImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.Ruby,
|
||||
strategies: [rubyRequireStrategy],
|
||||
};
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
/**
|
||||
* Rust import resolution config.
|
||||
* Rust module strategy (grouped imports, crate/super/self paths), then standard fallback.
|
||||
*/
|
||||
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
||||
import { createStandardStrategy } from '../standard.js';
|
||||
import { resolveRustImportInternal } from '../rust.js';
|
||||
|
||||
/** Rust module resolution strategy — handles grouped imports and crate/super/self paths. */
|
||||
export const rustModuleStrategy: ImportResolverStrategy = (rawImportPath, filePath, ctx) => {
|
||||
// Top-level grouped: use {crate::a, crate::b}
|
||||
if (rawImportPath.startsWith('{') && rawImportPath.endsWith('}')) {
|
||||
const inner = rawImportPath.slice(1, -1);
|
||||
const parts = inner
|
||||
.split(',')
|
||||
.map((p) => p.trim())
|
||||
.filter(Boolean);
|
||||
const resolved: string[] = [];
|
||||
for (const part of parts) {
|
||||
const r = resolveRustImportInternal(filePath, part, ctx.allFilePaths);
|
||||
if (r) resolved.push(r);
|
||||
}
|
||||
return resolved.length > 0 ? { kind: 'files', files: resolved } : null;
|
||||
}
|
||||
|
||||
// Scoped grouped: use crate::models::{User, Repo}
|
||||
const braceIdx = rawImportPath.indexOf('::{');
|
||||
if (braceIdx !== -1 && rawImportPath.endsWith('}')) {
|
||||
const pathPrefix = rawImportPath.substring(0, braceIdx);
|
||||
const braceContent = rawImportPath.substring(braceIdx + 3, rawImportPath.length - 1);
|
||||
const items = braceContent
|
||||
.split(',')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
const resolved: string[] = [];
|
||||
for (const item of items) {
|
||||
// Handle `use crate::models::{User, Repo as R}` — strip alias for resolution
|
||||
const itemName = item.includes(' as ') ? item.split(' as ')[0].trim() : item;
|
||||
const r = resolveRustImportInternal(filePath, `${pathPrefix}::${itemName}`, ctx.allFilePaths);
|
||||
if (r) resolved.push(r);
|
||||
}
|
||||
if (resolved.length > 0) return { kind: 'files', files: resolved };
|
||||
// Fallback: resolve the prefix path itself (e.g. crate::models -> models.rs)
|
||||
const prefixResult = resolveRustImportInternal(filePath, pathPrefix, ctx.allFilePaths);
|
||||
if (prefixResult) return { kind: 'files', files: [prefixResult] };
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export const rustImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.Rust,
|
||||
strategies: [rustModuleStrategy, createStandardStrategy(SupportedLanguages.Rust)],
|
||||
};
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
/**
|
||||
* Swift import resolution config.
|
||||
* Package.swift target map strategy — no standard fallback (unresolved = external framework).
|
||||
*
|
||||
* ## Performance (anti-O(imports × files))
|
||||
*
|
||||
* The previous implementation rescanned the whole `normalizedFileList`
|
||||
* on every import to collect the `.swift` files under the requested
|
||||
* target's directory — O(imports × files) per run, the exact hot path
|
||||
* fixed for Python in PR #1918. We now build a `target → files` index
|
||||
* ONCE per run, memoized on the stable `allFileList` array reference
|
||||
* (the same `ResolveCtx` — and therefore the same array — is passed to
|
||||
* every strategy invocation, per `import-processor`'s build-once
|
||||
* context). Lookup per import is then O(1).
|
||||
*
|
||||
* A file is attributed to a target iff its **forward-slash
|
||||
* (backslash-normalized), case-sensitive** path matches at a
|
||||
* **segment boundary**: it starts with `<targetDir>/` or contains
|
||||
* `/<targetDir>/`. `normalizedFileList` is
|
||||
* only backslash→forward-slash normalized — NOT lowercased — so the
|
||||
* match is case-sensitive. The returned paths are the original-case
|
||||
* `allFileList` entries, and the per-target file ORDER follows
|
||||
* `allFileList`.
|
||||
*
|
||||
* Import-config fans a file to every matching declared target. Module
|
||||
* grouping (`groupSwiftFilesByModule`) anchors target paths at the repo root
|
||||
* and picks the deepest. That divergence is intentional: this legacy
|
||||
* strategy only sees the root declaration map.
|
||||
*/
|
||||
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import { coerceDeclaredSwiftTargets, swiftDeclaredTargetPrefix } from '../../language-config.js';
|
||||
import type { ImportResolutionConfig, ImportResolverStrategy, ResolveCtx } from '../types.js';
|
||||
|
||||
interface SwiftTargetIndex {
|
||||
/** Target name → original-case `.swift` file paths under that target dir. */
|
||||
readonly byTarget: ReadonlyMap<string, string[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Memoized on the `allFileList` array identity. `import-processor` builds
|
||||
* the `ResolveCtx` once per run and threads the same object (and the same
|
||||
* `allFileList`) through every strategy call, so the WeakMap is keyed on a
|
||||
* stable reference and the index is built once — not once per import. A
|
||||
* fresh run produces a fresh array → a fresh index, so cross-run staleness
|
||||
* is impossible.
|
||||
*
|
||||
* DELIBERATELY NOT ON `import-resolvers/per-file-set.ts` (#2909 sweep): this is
|
||||
* a TWO-input memo keyed on ONE of them. The index is a function of both
|
||||
* `ctx` (`allFileList` + the index-aligned `normalizedFileList`) and `targets`,
|
||||
* but the key is only `ctx.allFileList`, and `perFileSet`'s `build: (key) => T`
|
||||
* hands the builder nothing but the key. It is sound here only because of an
|
||||
* invariant OUTSIDE the memo — `targets` is `ctx.configs.swiftPackageConfig
|
||||
* .targets`, so it shares `ctx`'s lifetime and cannot vary while
|
||||
* `ctx.allFileList` is fixed — and `perFileSet` has no way to express "and this
|
||||
* other input is pinned by the same lifetime". Re-keying on `ctx` to make
|
||||
* `targets` derivable from the key would change what the cache is keyed on and
|
||||
* force an unreachable null-config arm into the builder, so it is a behaviour
|
||||
* change rather than a consolidation. Leave it hand-rolled.
|
||||
*/
|
||||
const SWIFT_TARGET_INDEX_CACHE = new WeakMap<object, SwiftTargetIndex>();
|
||||
|
||||
function getSwiftTargetIndex(
|
||||
ctx: ResolveCtx,
|
||||
targets: ReadonlyMap<string, string>,
|
||||
): SwiftTargetIndex {
|
||||
const key = ctx.allFileList as object;
|
||||
const cached = SWIFT_TARGET_INDEX_CACHE.get(key);
|
||||
if (cached !== undefined) return cached;
|
||||
|
||||
// Pre-compute each target's directory prefix once (original case, to
|
||||
// match the legacy comparison against the forward-slash-normalized,
|
||||
// case-sensitive file list — see module docstring).
|
||||
const targetDirs: { name: string; prefix: string }[] = [];
|
||||
const byTarget = new Map<string, string[]>();
|
||||
for (const [name, dir] of targets) {
|
||||
targetDirs.push({ name, prefix: swiftDeclaredTargetPrefix(dir) });
|
||||
byTarget.set(name, []);
|
||||
}
|
||||
|
||||
// Single pass over the file list. `normalizedFileList` is forward-slash
|
||||
// (backslash-normalized), case-sensitive, and index-aligned with
|
||||
// `allFileList`; attribute the original-case path to every target whose
|
||||
// prefix the normalized path starts with (a file under a nested target
|
||||
// dir can legitimately belong to multiple configured targets — the
|
||||
// legacy per-import scan would have returned it for each).
|
||||
for (let i = 0; i < ctx.allFileList.length; i++) {
|
||||
const norm = ctx.normalizedFileList[i];
|
||||
if (!norm.endsWith('.swift')) continue;
|
||||
for (const { name, prefix } of targetDirs) {
|
||||
if (!norm.startsWith(prefix) && !norm.includes(`/${prefix}`)) continue;
|
||||
const bucket = byTarget.get(name);
|
||||
if (bucket !== undefined) bucket.push(ctx.allFileList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
const index: SwiftTargetIndex = { byTarget };
|
||||
SWIFT_TARGET_INDEX_CACHE.set(key, index);
|
||||
return index;
|
||||
}
|
||||
|
||||
/** Swift Package.swift target map resolution strategy. */
|
||||
export const swiftPackageStrategy: ImportResolverStrategy = (rawImportPath, _filePath, ctx) => {
|
||||
const swiftPackageConfig = ctx.configs.swiftPackageConfig;
|
||||
if (swiftPackageConfig == null) return null;
|
||||
const declared = coerceDeclaredSwiftTargets(swiftPackageConfig);
|
||||
if (declared == null) return null;
|
||||
const moduleName = rawImportPath.split('.')[0];
|
||||
if (moduleName === '' || !declared.has(moduleName)) {
|
||||
return null;
|
||||
}
|
||||
const index = getSwiftTargetIndex(ctx, declared);
|
||||
const files = index.byTarget.get(moduleName);
|
||||
if (files !== undefined && files.length > 0) {
|
||||
return { kind: 'files', files: [...files] };
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
export const swiftImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.Swift,
|
||||
strategies: [swiftPackageStrategy],
|
||||
};
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* TypeScript / JavaScript / Vue import resolution configs.
|
||||
* All use standard resolution — TS/JS with tsconfig path aliases,
|
||||
* Vue delegates to TypeScript's resolver.
|
||||
*/
|
||||
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import type { ImportResolutionConfig } from '../types.js';
|
||||
import { createStandardStrategy } from '../standard.js';
|
||||
|
||||
export const typescriptImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.TypeScript,
|
||||
strategies: [createStandardStrategy(SupportedLanguages.TypeScript)],
|
||||
};
|
||||
|
||||
export const javascriptImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.JavaScript,
|
||||
strategies: [createStandardStrategy(SupportedLanguages.JavaScript)],
|
||||
};
|
||||
|
||||
// Vue SFCs are preprocessed into TypeScript upstream of import resolution,
|
||||
// so the resolver intentionally runs as TypeScript. `language: Vue` here is
|
||||
// documentation-only metadata (see `ImportResolutionConfig.language` JSDoc
|
||||
// and ARCHITECTURE.md §Vue); it is not consumed by `createImportResolver`.
|
||||
export const vueImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.Vue,
|
||||
strategies: [createStandardStrategy(SupportedLanguages.TypeScript)],
|
||||
};
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
/**
|
||||
* Zig import resolution.
|
||||
*
|
||||
* Local-file imports (`@import("./foo.zig")`, `@import("foo.zig")`) resolve
|
||||
* relative to the importer. Bare names (`@import("bar")`) resolve through
|
||||
* build.zig.zon `.path` deps when a parsed ZigBuildZonConfig is available
|
||||
* (see language-config.ts `loadZigBuildConfig`). Everything unresolvable —
|
||||
* `std`, `builtin`, `root`, `.url`-based deps — returns an empty result so
|
||||
* it doesn't produce ghost import edges.
|
||||
*/
|
||||
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import type { ImportResolutionConfig, ImportResolverStrategy } from '../types.js';
|
||||
import { resolveZigImportInternal } from '../zig.js';
|
||||
|
||||
const stripQuotes = (s: string): string => s.replace(/^['"]|['"]$/g, '');
|
||||
|
||||
export const zigImportStrategy: ImportResolverStrategy = (rawImportPath, filePath, ctx) => {
|
||||
// tree-sitter-zig captures the string with surrounding quotes.
|
||||
const stripped = stripQuotes(rawImportPath);
|
||||
const resolved = resolveZigImportInternal(
|
||||
filePath,
|
||||
stripped,
|
||||
ctx.allFilePaths,
|
||||
ctx.configs.zigBuildZon ?? null,
|
||||
);
|
||||
// Unresolvable (stdlib / builtin / .url dep / missing file): stop the
|
||||
// chain with an empty result rather than falling through to suffix
|
||||
// matching, which could ghost-match an unrelated same-named file.
|
||||
return { kind: 'files', files: resolved ? [resolved] : [] };
|
||||
};
|
||||
|
||||
export const zigImportConfig: ImportResolutionConfig = {
|
||||
language: SupportedLanguages.Zig,
|
||||
strategies: [zigImportStrategy],
|
||||
};
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/**
|
||||
* Go package import resolution — internal helpers.
|
||||
*
|
||||
* Strategy lives in configs/go.ts.
|
||||
* This file contains the shared helpers used by the strategy.
|
||||
*
|
||||
* **Reachability, as of #2929:** nothing in production calls either export
|
||||
* today. The only path in is `configs/go.ts` → `createImportResolver` →
|
||||
* the `importResolver` field on Go's `LanguageProvider`, and that field is
|
||||
* read at exactly two lines — `import-target-adapter.ts:74-75` — whose two
|
||||
* exports (`buildImportTargetWorkspace`,
|
||||
* `resolveImportTargetAcrossLanguages`) have no importer anywhere but their
|
||||
* own unit test. So this is a live-looking but currently unwired leg; the
|
||||
* tests in `test/unit/import-resolvers/go-package-resolve.test.ts` are the
|
||||
* only thing watching it.
|
||||
*/
|
||||
|
||||
import type { GoModuleConfig } from '../language-config.js';
|
||||
|
||||
/** `'/'`, for the parent-directory boundary check in `resolveGoPackage`. */
|
||||
const SLASH_CODE = 47;
|
||||
|
||||
/**
|
||||
* Extract the package directory suffix from a Go import path.
|
||||
* Returns the suffix string (e.g., "/internal/auth/") or null if invalid.
|
||||
*/
|
||||
export function resolveGoPackageDir(importPath: string, goModule: GoModuleConfig): string | null {
|
||||
if (!importPath.startsWith(goModule.modulePath)) return null;
|
||||
const relativePkg = importPath.slice(goModule.modulePath.length + 1);
|
||||
if (!relativePkg) return null;
|
||||
return '/' + relativePkg + '/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a Go internal package import to all .go files in the package directory.
|
||||
* Returns an array of file paths.
|
||||
*/
|
||||
export function resolveGoPackage(
|
||||
importPath: string,
|
||||
goModule: GoModuleConfig,
|
||||
normalizedFileList: readonly string[],
|
||||
allFileList: readonly string[],
|
||||
): string[] {
|
||||
// Identical to the six lines this used to re-derive; `resolveGoPackageDir`
|
||||
// returns the '/'-wrapped form and the scan wants the bare path, so unwrap.
|
||||
const pkgDir = resolveGoPackageDir(importPath, goModule);
|
||||
if (pkgDir === null) return [];
|
||||
const relativePkg = pkgDir.slice(1, -1); // "/internal/auth/" → "internal/auth"
|
||||
|
||||
const pkgLen = relativePkg.length; // >= 1: `resolveGoPackageDir` rejects empty
|
||||
const matches: string[] = [];
|
||||
|
||||
for (let i = 0; i < normalizedFileList.length; i++) {
|
||||
const normalized = normalizedFileList[i];
|
||||
if (!normalized.endsWith('.go') || normalized.endsWith('_test.go')) continue;
|
||||
// The file's PARENT directory ends with the package path — the same
|
||||
// predicate `package-dir-index.ts` states. This used to ask `indexOf` for
|
||||
// the FIRST `/<pkg>/` and then check that nothing after it held a slash,
|
||||
// which made `a/pkg/b/pkg/x.go` not a member of `pkg` (#2881).
|
||||
//
|
||||
// Expressed as "`relativePkg` sits immediately before the last slash, on a
|
||||
// segment boundary". The boundary is either the start of the path (an
|
||||
// import matching from index 0, `internal/auth/x.go`) or a `/` — which is
|
||||
// what the old `'/' + path` cons bought, at the price of a per-file
|
||||
// concatenation the first `endsWith` forced V8 to flatten (#2929).
|
||||
//
|
||||
// Rewriting this as `endsWith(relativePkg, lastSlash)` buys nothing: the
|
||||
// two-argument overload measured a wash against `startsWith(needle, pos)`
|
||||
// here (10.28 ns vs 9.82 ns), so it trades the clarity of an explicit start
|
||||
// index for no gain. A "the 2-arg overload leaves V8's fast path, 20x"
|
||||
// claim from review did not reproduce on Node 22.18 — its baseline was a
|
||||
// one-argument call that early-exited on the length precheck.
|
||||
const start = normalized.lastIndexOf('/') - pkgLen; // < 0 when there is no parent dir
|
||||
if (start < 0 || !normalized.startsWith(relativePkg, start)) continue;
|
||||
if (start > 0 && normalized.charCodeAt(start - 1) !== SLASH_CODE) continue;
|
||||
matches.push(allFileList[i]);
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
/**
|
||||
* JVM import resolution — internal helpers (Java + Kotlin).
|
||||
*
|
||||
* Strategies live in configs/jvm.ts.
|
||||
* This file contains shared helpers for wildcard/member resolution
|
||||
* and the Kotlin wildcard preprocessor.
|
||||
*/
|
||||
|
||||
import type { SuffixIndex } from './utils.js';
|
||||
import type { SyntaxNode } from '../utils/ast-helpers.js';
|
||||
|
||||
/** Kotlin file extensions for JVM resolver reuse */
|
||||
export const KOTLIN_EXTENSIONS: readonly string[] = ['.kt', '.kts'];
|
||||
|
||||
/**
|
||||
* Append .* to a Kotlin import path if the AST has a wildcard_import sibling node.
|
||||
* Pure function — returns a new string without mutating the input.
|
||||
*/
|
||||
export const appendKotlinWildcard = (importPath: string, importNode: SyntaxNode): string => {
|
||||
for (let i = 0; i < importNode.childCount; i++) {
|
||||
if (importNode.child(i)?.type === 'wildcard_import') {
|
||||
return importPath.endsWith('.*') ? importPath : `${importPath}.*`;
|
||||
}
|
||||
}
|
||||
return importPath;
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolve a JVM wildcard import (com.example.*) to all matching files.
|
||||
* Works for both Java (.java) and Kotlin (.kt, .kts).
|
||||
*/
|
||||
export function resolveJvmWildcard(
|
||||
importPath: string,
|
||||
normalizedFileList: readonly string[],
|
||||
allFileList: readonly string[],
|
||||
extensions: readonly string[],
|
||||
index?: SuffixIndex,
|
||||
): string[] {
|
||||
// "com.example.util.*" -> "com/example/util"
|
||||
const packagePath = importPath.slice(0, -2).replace(/\./g, '/');
|
||||
|
||||
if (index) {
|
||||
const candidates = extensions.flatMap((ext) => index.getFilesInDir(packagePath, ext));
|
||||
// Filter to only direct children (no subdirectories)
|
||||
const packageSuffix = '/' + packagePath + '/';
|
||||
const packagePrefix = packagePath + '/';
|
||||
return candidates.filter((f) => {
|
||||
const normalized = f.replace(/\\/g, '/');
|
||||
// Match both nested (src/models/User.kt) and root-level (models/User.kt) packages
|
||||
let afterPkg: string;
|
||||
const idx = normalized.lastIndexOf(packageSuffix);
|
||||
if (idx >= 0) {
|
||||
afterPkg = normalized.substring(idx + packageSuffix.length);
|
||||
} else if (normalized.startsWith(packagePrefix)) {
|
||||
afterPkg = normalized.substring(packagePrefix.length);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return !afterPkg.includes('/');
|
||||
});
|
||||
}
|
||||
|
||||
// Fallback: linear scan
|
||||
const packageSuffix = '/' + packagePath + '/';
|
||||
const packagePrefix = packagePath + '/';
|
||||
const matches: string[] = [];
|
||||
for (let i = 0; i < normalizedFileList.length; i++) {
|
||||
const normalized = normalizedFileList[i];
|
||||
if (!extensions.some((ext) => normalized.endsWith(ext))) continue;
|
||||
// Match both nested (src/models/User.kt) and root-level (models/User.kt) packages
|
||||
let afterPackage: string | null = null;
|
||||
if (normalized.includes(packageSuffix)) {
|
||||
afterPackage = normalized.substring(
|
||||
normalized.lastIndexOf(packageSuffix) + packageSuffix.length,
|
||||
);
|
||||
} else if (normalized.startsWith(packagePrefix)) {
|
||||
afterPackage = normalized.substring(packagePrefix.length);
|
||||
}
|
||||
if (afterPackage !== null && !afterPackage.includes('/')) {
|
||||
matches.push(allFileList[i]);
|
||||
}
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to resolve a JVM member/static import by stripping the member name.
|
||||
* Java: "com.example.Constants.VALUE" -> resolve "com.example.Constants"
|
||||
* Kotlin: "com.example.Constants.VALUE" -> resolve "com.example.Constants"
|
||||
*/
|
||||
export function resolveJvmMemberImport(
|
||||
importPath: string,
|
||||
normalizedFileList: readonly string[],
|
||||
allFileList: readonly string[],
|
||||
extensions: readonly string[],
|
||||
index?: SuffixIndex,
|
||||
): string | null {
|
||||
// Member imports: com.example.Constants.VALUE or com.example.Constants.*
|
||||
// The last segment is a member name if it starts with lowercase, is ALL_CAPS, or is a wildcard
|
||||
const segments = importPath.split('.');
|
||||
if (segments.length < 3) return null;
|
||||
|
||||
const lastSeg = segments[segments.length - 1];
|
||||
if (lastSeg === '*' || /^[a-z]/.test(lastSeg) || /^[A-Z_]+$/.test(lastSeg)) {
|
||||
const classPath = segments.slice(0, -1).join('/');
|
||||
|
||||
for (const ext of extensions) {
|
||||
const classSuffix = classPath + ext;
|
||||
if (index) {
|
||||
const result = index.get(classSuffix) || index.getInsensitive(classSuffix);
|
||||
if (result) return result;
|
||||
} else {
|
||||
const fullSuffix = '/' + classSuffix;
|
||||
for (let i = 0; i < normalizedFileList.length; i++) {
|
||||
if (
|
||||
normalizedFileList[i].endsWith(fullSuffix) ||
|
||||
normalizedFileList[i].toLowerCase().endsWith(fullSuffix.toLowerCase())
|
||||
) {
|
||||
return allFileList[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
import { buildSuffixIndex, type SuffixIndex } from './utils.js';
|
||||
|
||||
/**
|
||||
* Everything the standard `resolveTsTarget` path derives from one workspace
|
||||
* file set: the file list, the lower-cased file list, the suffix index and the
|
||||
* per-pass `resolveCache`.
|
||||
*
|
||||
* Without this memoization the resolver re-derived `allFileList` and
|
||||
* `normalizedFileList` (both O(N_files)), rebuilt the index and threw away the
|
||||
* `resolveCache` on every import — O(N_files × N_imports) total work for what
|
||||
* should be O(N_files + N_imports).
|
||||
*/
|
||||
export interface ImportPassCache {
|
||||
readonly allFilePaths: Set<string>;
|
||||
readonly allFileList: readonly string[];
|
||||
readonly normalizedFileList: readonly string[];
|
||||
readonly index: SuffixIndex;
|
||||
readonly resolveCache: Map<string, string | null>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build that state. Shared by every adapter whose resolution runs through
|
||||
* `resolveTsTarget`.
|
||||
*
|
||||
* Not a dedup of identical copies, and the difference is the point. At
|
||||
* 49c5b7d81 each of those adapters carried this record inline and they did NOT
|
||||
* agree: `languages/typescript/scope-resolver.ts` and
|
||||
* `languages/vue/import-target.ts` held six byte-identical fields built around
|
||||
* `index: buildSuffixIndex(normalizedFileList, allFileList)`, while
|
||||
* `languages/javascript/import-target.ts` held five and never called
|
||||
* `buildSuffixIndex` at all. That one missing field IS the O(imports × files)
|
||||
* defect PR #2911 fixed — `resolveTsTarget` fell back to `suffixResolve`'s
|
||||
* linear scan for every JavaScript import — and the header of
|
||||
* `languages/javascript/import-target.ts` carries the measurements. Hoisting
|
||||
* the builder is what makes a fourth adapter unable to omit it again: `index`
|
||||
* is not optional on `ImportPassCache`.
|
||||
*
|
||||
* The BUILDER is shared; the MEMO deliberately is not. Each adapter wraps this
|
||||
* in its own `perFileSet(...)`, so each gets its own `WeakMap`, its own index
|
||||
* instance and — the one that would be a behaviour change — its own
|
||||
* `resolveCache`. The languages disagree about what a specifier resolves to
|
||||
* (`tsconfigPaths` is read from config for TypeScript and Vue, pinned to `null`
|
||||
* for JavaScript, and the tried extension list differs), so one shared resolve
|
||||
* cache across them would hand a language another language's answers.
|
||||
*
|
||||
* Sharing the builder is a code dedup and nothing more: it buys no runtime
|
||||
* reuse, because there is none to buy. Each provider pass builds its own
|
||||
* `allFilePaths` Set (`scope-resolution/pipeline/run.ts`, per provider), so
|
||||
* TypeScript's set and JavaScript's set are different objects and therefore
|
||||
* different `WeakMap` keys even where the two memos are the same code.
|
||||
*/
|
||||
export function buildImportPassCache(allFilePaths: ReadonlySet<string>): ImportPassCache {
|
||||
const allFileList = Array.from(allFilePaths);
|
||||
// LOWERCASED, not slash-normalized — unlike every other caller of
|
||||
// `buildSuffixIndex`. That is what `alreadyLowercased` below records.
|
||||
const normalizedFileList = allFileList.map((f) => f.toLowerCase());
|
||||
return {
|
||||
// Copied ONCE per file set, not once per import: `TsResolveContext` wants a
|
||||
// mutable `Set` and the orchestrator hands us a `ReadonlySet`. The copy is
|
||||
// not the #1918 hazard because the cache KEY is the caller's original Set.
|
||||
allFilePaths: new Set(allFilePaths),
|
||||
allFileList,
|
||||
normalizedFileList,
|
||||
// Every suffix of an all-lowercase path is itself lowercase, so the index's
|
||||
// case-folded map came out a byte-for-byte copy of its exact map — same
|
||||
// keys, same values, same insertion order — one per `ImportPassCache`, so
|
||||
// once per adapter per pass. Measured 14.00 MiB at 32 000 paths, 29.8% of
|
||||
// the retained `ImportPassCache`. The flag drops the copy; it does not change
|
||||
// what `getInsensitive` answers, because the copy was the identity (see
|
||||
// `SuffixIndexOptions`). Checked, not assumed: over 474 524 probes on four
|
||||
// mixed-case corpora — Vue PascalCase plus alias specifiers, case-colliding
|
||||
// twins, a 600-file deep monorepo, and Unicode paths carrying final sigma,
|
||||
// dotted-I and sharp-S — the two maps came out byte-identical, the exact
|
||||
// map was the sole answerer 0 times, and `get(s) || getInsensitive(s)`
|
||||
// returned the same file 474 524 times out of 474 524.
|
||||
index: buildSuffixIndex(normalizedFileList, allFileList, { alreadyLowercased: true }),
|
||||
resolveCache: new Map(),
|
||||
};
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
/**
|
||||
* Import resolver factory — creates a composable import resolver from
|
||||
* an ordered list of strategies.
|
||||
*
|
||||
* Mirrors the method-extractors/generic.ts and call-extractors/generic.ts
|
||||
* pattern: declare a config per language, produce a runtime resolver via factory.
|
||||
*
|
||||
* Each strategy is tried in order. The first non-null result wins.
|
||||
* A result with an empty `files` array is treated as "handled but unresolved"
|
||||
* (stops the chain without producing import edges).
|
||||
*/
|
||||
|
||||
import type { ImportResolverFn, ImportResolutionConfig } from './types.js';
|
||||
|
||||
/**
|
||||
* Create an ImportResolverFn from a declarative config.
|
||||
*
|
||||
* Chains strategies in declaration order — first non-null result wins.
|
||||
* Returns null only if every strategy returns null.
|
||||
*
|
||||
* Error behaviour: if a strategy throws, the error propagates immediately
|
||||
* and remaining strategies are not tried. Strategies are expected to be
|
||||
* pure data transforms that never throw; any unexpected exception indicates
|
||||
* a bug in the strategy implementation.
|
||||
*/
|
||||
export function createImportResolver(config: ImportResolutionConfig): ImportResolverFn {
|
||||
const { strategies } = config;
|
||||
return (rawImportPath, filePath, ctx) => {
|
||||
for (const strategy of strategies) {
|
||||
const result = strategy(rawImportPath, filePath, ctx);
|
||||
if (result) return result;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/**
|
||||
* Rust module import resolution — internal helpers.
|
||||
*
|
||||
* Strategy lives in configs/rust.ts.
|
||||
* This file contains shared helpers used by the strategy and standard.ts.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolve Rust use-path to a file (low-level helper).
|
||||
* Handles crate::, super::, self:: prefixes and :: path separators.
|
||||
*/
|
||||
export function resolveRustImportInternal(
|
||||
currentFile: string,
|
||||
importPath: string,
|
||||
allFiles: ReadonlySet<string>,
|
||||
): string | null {
|
||||
let rustPath: string;
|
||||
|
||||
if (importPath.startsWith('crate::')) {
|
||||
// crate:: resolves from src/ directory (standard Rust layout)
|
||||
rustPath = importPath.slice(7).replace(/::/g, '/');
|
||||
|
||||
// Try from src/ (standard layout)
|
||||
const fromSrc = tryRustModulePath('src/' + rustPath, allFiles);
|
||||
if (fromSrc) return fromSrc;
|
||||
|
||||
// Try from repo root (non-standard)
|
||||
const fromRoot = tryRustModulePath(rustPath, allFiles);
|
||||
if (fromRoot) return fromRoot;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (importPath.startsWith('super::')) {
|
||||
// super:: = parent directory of current file's module
|
||||
const currentDir = currentFile.split('/').slice(0, -1);
|
||||
currentDir.pop(); // Go up one level for super::
|
||||
rustPath = importPath.slice(7).replace(/::/g, '/');
|
||||
const fullPath = [...currentDir, rustPath].join('/');
|
||||
return tryRustModulePath(fullPath, allFiles);
|
||||
}
|
||||
|
||||
if (importPath.startsWith('self::')) {
|
||||
// self:: = current module's directory
|
||||
const currentDir = currentFile.split('/').slice(0, -1);
|
||||
rustPath = importPath.slice(6).replace(/::/g, '/');
|
||||
const fullPath = [...currentDir, rustPath].join('/');
|
||||
return tryRustModulePath(fullPath, allFiles);
|
||||
}
|
||||
|
||||
// Bare path without prefix (e.g., from a use in a nested module)
|
||||
// Convert :: to / and try suffix matching
|
||||
if (importPath.includes('::')) {
|
||||
rustPath = importPath.replace(/::/g, '/');
|
||||
return tryRustModulePath(rustPath, allFiles);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to resolve a Rust module path to a file.
|
||||
* Tries: path.rs, path/mod.rs, and with the last segment stripped
|
||||
* (last segment might be a symbol name, not a module).
|
||||
*/
|
||||
export function tryRustModulePath(
|
||||
modulePath: string,
|
||||
allFiles: ReadonlySet<string>,
|
||||
): string | null {
|
||||
// Try direct: path.rs
|
||||
if (allFiles.has(modulePath + '.rs')) return modulePath + '.rs';
|
||||
// Try directory: path/mod.rs
|
||||
if (allFiles.has(modulePath + '/mod.rs')) return modulePath + '/mod.rs';
|
||||
// Try path/lib.rs (for crate root)
|
||||
if (allFiles.has(modulePath + '/lib.rs')) return modulePath + '/lib.rs';
|
||||
|
||||
// The last segment might be a symbol (function, struct, etc.), not a module.
|
||||
// Strip it and try again.
|
||||
const lastSlash = modulePath.lastIndexOf('/');
|
||||
if (lastSlash > 0) {
|
||||
const parentPath = modulePath.substring(0, lastSlash);
|
||||
if (allFiles.has(parentPath + '.rs')) return parentPath + '.rs';
|
||||
if (allFiles.has(parentPath + '/mod.rs')) return parentPath + '/mod.rs';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1,219 +0,0 @@
|
|||
/**
|
||||
* Standard import path resolution.
|
||||
* Handles relative imports, path alias rewriting, and generic suffix matching.
|
||||
* Used as the fallback when language-specific resolvers don't match.
|
||||
*/
|
||||
|
||||
import type { SuffixIndex } from './utils.js';
|
||||
import { tryResolveWithExtensions, suffixResolve } from './utils.js';
|
||||
import { resolveRustImportInternal } from './rust.js';
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import type { ImportResult, ImportResolverStrategy, ResolveCtx } from './types.js';
|
||||
import type { TsconfigPaths } from '../language-config.js';
|
||||
|
||||
/** Max entries in the resolve cache. Beyond this, entries are evicted.
|
||||
* 100K entries ≈ 15MB — covers the most common import patterns. */
|
||||
export const RESOLVE_CACHE_CAP = 100_000;
|
||||
|
||||
/**
|
||||
* Resolve an import path to a file path in the repository.
|
||||
*
|
||||
* Language-specific preprocessing is applied before the generic resolution:
|
||||
* - TypeScript/JavaScript: rewrites tsconfig path aliases
|
||||
* - Rust: converts crate::/super::/self:: to relative paths
|
||||
*
|
||||
* Java wildcards and Go package imports are handled by the scope-resolution
|
||||
* phase because they resolve to multiple files.
|
||||
*/
|
||||
export const resolveImportPath = (
|
||||
currentFile: string,
|
||||
importPath: string,
|
||||
allFiles: Set<string>,
|
||||
allFileList: readonly string[],
|
||||
normalizedFileList: readonly string[],
|
||||
resolveCache: Map<string, string | null>,
|
||||
language: SupportedLanguages,
|
||||
tsconfigPaths: TsconfigPaths | null,
|
||||
index?: SuffixIndex,
|
||||
): string | null => {
|
||||
const cacheKey = `${currentFile}::${importPath}`;
|
||||
if (resolveCache.has(cacheKey)) return resolveCache.get(cacheKey) ?? null;
|
||||
|
||||
const cache = (result: string | null): string | null => {
|
||||
// Evict oldest 20% when cap is reached instead of clearing all
|
||||
if (resolveCache.size >= RESOLVE_CACHE_CAP) {
|
||||
const evictCount = Math.floor(RESOLVE_CACHE_CAP * 0.2);
|
||||
const iter = resolveCache.keys();
|
||||
for (let i = 0; i < evictCount; i++) {
|
||||
const key = iter.next().value;
|
||||
if (key !== undefined) resolveCache.delete(key);
|
||||
}
|
||||
}
|
||||
resolveCache.set(cacheKey, result);
|
||||
return result;
|
||||
};
|
||||
|
||||
// ---- TypeScript/JavaScript: rewrite path aliases ----
|
||||
if (
|
||||
(language === SupportedLanguages.TypeScript || language === SupportedLanguages.JavaScript) &&
|
||||
tsconfigPaths &&
|
||||
!importPath.startsWith('.')
|
||||
) {
|
||||
for (const [aliasPrefix, targetPrefix] of tsconfigPaths.aliases) {
|
||||
if (importPath.startsWith(aliasPrefix)) {
|
||||
const remainder = importPath.slice(aliasPrefix.length);
|
||||
// Build the rewritten path relative to baseUrl
|
||||
const rewritten =
|
||||
tsconfigPaths.baseUrl === '.'
|
||||
? targetPrefix + remainder
|
||||
: tsconfigPaths.baseUrl + '/' + targetPrefix + remainder;
|
||||
|
||||
// Try direct resolution from repo root
|
||||
const resolved = tryResolveWithExtensions(rewritten, allFiles);
|
||||
if (resolved) return cache(resolved);
|
||||
|
||||
// ESM fallback: strip .js/.jsx/.mjs/.cjs and retry with TS equivalents
|
||||
const strippedAlias = stripJsExtension(rewritten);
|
||||
if (strippedAlias !== null) {
|
||||
const esmResolved = tryResolveWithExtensions(strippedAlias, allFiles);
|
||||
if (esmResolved) return cache(esmResolved);
|
||||
}
|
||||
|
||||
// Try suffix matching as fallback
|
||||
const parts = rewritten.split('/').filter(Boolean);
|
||||
const suffixResult = suffixResolve(parts, normalizedFileList, allFileList, index);
|
||||
if (suffixResult) return cache(suffixResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Rust: convert module path syntax to file paths ----
|
||||
if (language === SupportedLanguages.Rust) {
|
||||
// Handle grouped imports: use crate::module::{Foo, Bar, Baz}
|
||||
// Extract the prefix path before ::{...} and resolve the module, not the symbols
|
||||
let rustImportPath = importPath;
|
||||
const braceIdx = importPath.indexOf('::{');
|
||||
if (braceIdx !== -1) {
|
||||
rustImportPath = importPath.substring(0, braceIdx);
|
||||
} else if (importPath.startsWith('{') && importPath.endsWith('}')) {
|
||||
// Top-level grouped imports: use {crate::a, crate::b}
|
||||
// Iterate each part and return the first that resolves. This function returns a single
|
||||
// string, so callers that need ALL edges must intercept before reaching here (the
|
||||
// scope-resolution phase handles Rust grouped-import blocks). This fallback
|
||||
// handles any path that reaches resolveImportPath directly.
|
||||
const inner = importPath.slice(1, -1);
|
||||
const parts = inner
|
||||
.split(',')
|
||||
.map((p) => p.trim())
|
||||
.filter(Boolean);
|
||||
for (const part of parts) {
|
||||
const partResult = resolveRustImportInternal(currentFile, part, allFiles);
|
||||
if (partResult) return cache(partResult);
|
||||
}
|
||||
return cache(null);
|
||||
}
|
||||
|
||||
const rustResult = resolveRustImportInternal(currentFile, rustImportPath, allFiles);
|
||||
if (rustResult) return cache(rustResult);
|
||||
// Fall through to generic resolution if Rust-specific didn't match
|
||||
}
|
||||
|
||||
// ---- Generic relative import resolution (./ and ../) ----
|
||||
const currentDir = currentFile.split('/').slice(0, -1);
|
||||
const parts = importPath.split('/');
|
||||
|
||||
for (const part of parts) {
|
||||
if (part === '.') continue;
|
||||
if (part === '..') {
|
||||
currentDir.pop();
|
||||
} else {
|
||||
currentDir.push(part);
|
||||
}
|
||||
}
|
||||
|
||||
const basePath = currentDir.join('/');
|
||||
|
||||
if (importPath.startsWith('.')) {
|
||||
const resolved = tryResolveWithExtensions(basePath, allFiles);
|
||||
if (resolved) return cache(resolved);
|
||||
|
||||
// TypeScript ESM: imports use .js/.jsx/.mjs/.cjs but source files are
|
||||
// .ts/.tsx/.mts/.cts. Strip the JS-family extension and re-resolve.
|
||||
if (language === SupportedLanguages.TypeScript || language === SupportedLanguages.JavaScript) {
|
||||
const stripped = stripJsExtension(basePath);
|
||||
if (stripped !== null) {
|
||||
return cache(tryResolveWithExtensions(stripped, allFiles));
|
||||
}
|
||||
}
|
||||
|
||||
return cache(null);
|
||||
}
|
||||
|
||||
// ---- Generic package/absolute import resolution (suffix matching) ----
|
||||
// Java wildcards are handled by the scope-resolution phase, not here; this
|
||||
// resolver returns null for `.*` so it never produces a single-file match.
|
||||
if (importPath.endsWith('.*')) {
|
||||
return cache(null);
|
||||
}
|
||||
|
||||
// C/C++ includes use actual file paths (e.g. "animal.h") — don't convert dots to slashes
|
||||
const isCpp = language === SupportedLanguages.C || language === SupportedLanguages.CPlusPlus;
|
||||
const pathLike = importPath.includes('/') || isCpp ? importPath : importPath.replace(/\./g, '/');
|
||||
const pathParts = pathLike.split('/').filter(Boolean);
|
||||
|
||||
const resolved = suffixResolve(pathParts, normalizedFileList, allFileList, index);
|
||||
return cache(resolved);
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// Per-language dispatch functions (moved from import-resolution.ts)
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* Standard single-file resolution (TS/JS/C/C++ and fallback for other languages).
|
||||
* Handles relative imports, tsconfig path aliases, and suffix matching.
|
||||
*/
|
||||
export function resolveStandard(
|
||||
rawImportPath: string,
|
||||
filePath: string,
|
||||
ctx: ResolveCtx,
|
||||
language: SupportedLanguages,
|
||||
): ImportResult {
|
||||
const resolvedPath = resolveImportPath(
|
||||
filePath,
|
||||
rawImportPath,
|
||||
ctx.allFilePaths,
|
||||
ctx.allFileList,
|
||||
ctx.normalizedFileList,
|
||||
ctx.resolveCache,
|
||||
language,
|
||||
ctx.configs.tsconfigPaths,
|
||||
ctx.index,
|
||||
);
|
||||
return resolvedPath ? { kind: 'files', files: [resolvedPath] } : null;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Strategy factory — composable hook for ImportResolutionConfig
|
||||
// ============================================================================
|
||||
|
||||
/** Create a reusable standard-resolution strategy for a given language. */
|
||||
export function createStandardStrategy(language: SupportedLanguages): ImportResolverStrategy {
|
||||
return (raw, fp, ctx) => resolveStandard(raw, fp, ctx, language);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ESM extension helpers
|
||||
// ============================================================================
|
||||
|
||||
/** JS-family extensions that TypeScript ESM maps to TS equivalents. */
|
||||
const JS_EXTENSION_PATTERN = /\.(js|jsx|mjs|cjs)$/;
|
||||
|
||||
/**
|
||||
* Strip a JS-family extension from a path, returning the stem.
|
||||
* Returns `null` if the path does not end with a JS-family extension.
|
||||
*/
|
||||
export function stripJsExtension(path: string): string | null {
|
||||
const match = JS_EXTENSION_PATTERN.exec(path);
|
||||
return match ? path.slice(0, -match[0].length) : null;
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
/**
|
||||
* Import resolution types — shared across all per-language resolvers.
|
||||
*
|
||||
* Extracted from import-resolution.ts to co-locate types with their consumers.
|
||||
*/
|
||||
|
||||
import type { ImportConfigs } from '../language-config.js';
|
||||
import type { SuffixIndex } from './utils.js';
|
||||
import type { SupportedLanguages } from 'gitnexus-shared';
|
||||
|
||||
/**
|
||||
* Result of resolving an import via language-specific dispatch.
|
||||
* - 'files': resolved to one or more files -> add to ImportMap
|
||||
* - 'package': resolved to a directory -> add graph edges + store dirSuffix in PackageMap
|
||||
* - null: no resolution (external dependency, etc.)
|
||||
*/
|
||||
export type ImportResult =
|
||||
| { kind: 'files'; files: string[] }
|
||||
| { kind: 'package'; files: string[]; dirSuffix: string }
|
||||
| null;
|
||||
|
||||
/** Pre-built lookup structures for import resolution. Build once, reuse across chunks. */
|
||||
export interface ImportResolutionContext {
|
||||
allFilePaths: Set<string>;
|
||||
allFileList: string[];
|
||||
normalizedFileList: string[];
|
||||
index: SuffixIndex;
|
||||
resolveCache: Map<string, string | null>;
|
||||
}
|
||||
|
||||
/** Full context for import resolution: file lookups + language configs. */
|
||||
export interface ResolveCtx extends ImportResolutionContext {
|
||||
configs: ImportConfigs;
|
||||
}
|
||||
|
||||
/** Per-language import resolver -- function alias matching ExportChecker/CallRouter pattern. */
|
||||
export type ImportResolverFn = (
|
||||
rawImportPath: string,
|
||||
filePath: string,
|
||||
resolveCtx: ResolveCtx,
|
||||
) => ImportResult;
|
||||
|
||||
/**
|
||||
* A single import resolution strategy — one step in a composable chain.
|
||||
* Same signature as ImportResolverFn. Returns null to let the next strategy
|
||||
* in the chain try; returns a result (even with empty files) to stop the chain.
|
||||
*/
|
||||
export type ImportResolverStrategy = ImportResolverFn;
|
||||
|
||||
/**
|
||||
* Declarative config for composable import resolution — mirrors the
|
||||
* MethodExtractionConfig / CallExtractionConfig pattern.
|
||||
*
|
||||
* Each language declares an ordered list of strategies to try.
|
||||
* The factory (`createImportResolver`) chains them: first non-null result wins.
|
||||
*/
|
||||
export interface ImportResolutionConfig {
|
||||
/**
|
||||
* Documentation-only metadata identifying which language this config serves.
|
||||
* **Not used by `createImportResolver`** — the factory only iterates `strategies`.
|
||||
* Useful for logging, debugging, and compile-time exhaustiveness checks when
|
||||
* mapping `SupportedLanguages → ImportResolutionConfig` in language providers.
|
||||
*/
|
||||
readonly language: SupportedLanguages;
|
||||
readonly strategies: readonly ImportResolverStrategy[];
|
||||
}
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
/**
|
||||
* Bridge between CLI-package per-language `ImportResolverFn`s and the
|
||||
* shared `FinalizeHooks.resolveImportTarget` contract
|
||||
* (RFC §5.2; Ring 2 PKG #922).
|
||||
*
|
||||
* The shared finalize algorithm (#915) asks one question:
|
||||
*
|
||||
* resolveImportTarget(targetRaw, fromFile, workspaceIndex): string | null
|
||||
*
|
||||
* The CLI already has 16 language-specific resolvers satisfying a
|
||||
* richer signature:
|
||||
*
|
||||
* ImportResolverFn(rawImportPath, filePath, resolveCtx): ImportResult
|
||||
*
|
||||
* This module builds a dispatch adapter — one FinalizeHook implementation
|
||||
* that looks up the file's language from its path and delegates to the
|
||||
* right per-language resolver. Callers package per-language resolvers +
|
||||
* a shared `ResolveCtx` into an opaque `ImportTargetWorkspace` and pass
|
||||
* it as `workspaceIndex` to `finalizeScopeModel`.
|
||||
*
|
||||
* ## What's deliberately NOT here
|
||||
*
|
||||
* - **Re-implementation of any per-language resolver.** We wrap the
|
||||
* existing `importResolver` field on each `LanguageProvider` — the
|
||||
* same code path the legacy DAG uses today.
|
||||
* - **Dynamic-import handling.** The shared finalize algorithm short-
|
||||
* circuits `ParsedImport { kind: 'dynamic-unresolved' }` before
|
||||
* calling `resolveImportTarget`, so the adapter never sees those.
|
||||
* - **`importPathPreprocessor`.** Preprocessing belongs inside the
|
||||
* provider's `interpretImport` hook (which writes the final
|
||||
* `ParsedImport.targetRaw`). By the time finalize passes a
|
||||
* `targetRaw` to this adapter, it is the string the provider wants
|
||||
* resolved verbatim.
|
||||
*/
|
||||
|
||||
import {
|
||||
getLanguageFromFilename,
|
||||
type SupportedLanguages,
|
||||
type WorkspaceIndex,
|
||||
} from 'gitnexus-shared';
|
||||
import type { ImportResolverFn, ImportResult, ResolveCtx } from './import-resolvers/types.js';
|
||||
import type { LanguageProvider } from './language-provider.js';
|
||||
|
||||
/** A single language's resolver bundled with the context it needs. */
|
||||
export interface LanguageResolverEntry {
|
||||
readonly resolver: ImportResolverFn;
|
||||
readonly ctx: ResolveCtx;
|
||||
}
|
||||
|
||||
/**
|
||||
* The opaque `workspaceIndex` shape recognized by
|
||||
* `resolveImportTargetAcrossLanguages`. Built once per ingestion run via
|
||||
* `buildImportTargetWorkspace`, threaded through `finalizeScopeModel`.
|
||||
*/
|
||||
export interface ImportTargetWorkspace {
|
||||
readonly perLanguage: ReadonlyMap<SupportedLanguages, LanguageResolverEntry>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the workspace index from a map of language → provider. Providers
|
||||
* whose `importResolver` is absent are silently skipped (no language will
|
||||
* ever hit that branch at dispatch time).
|
||||
*
|
||||
* The `resolveCtx` is shared across all languages. Callers assemble it
|
||||
* once per run (the existing pipeline already does this for the legacy
|
||||
* DAG) and hand it to both the legacy resolution path and this factory.
|
||||
*/
|
||||
export function buildImportTargetWorkspace(
|
||||
providers: ReadonlyMap<SupportedLanguages, LanguageProvider>,
|
||||
resolveCtx: ResolveCtx,
|
||||
): ImportTargetWorkspace {
|
||||
const perLanguage = new Map<SupportedLanguages, LanguageResolverEntry>();
|
||||
for (const [lang, provider] of providers) {
|
||||
if (provider.importResolver === undefined) continue;
|
||||
perLanguage.set(lang, { resolver: provider.importResolver, ctx: resolveCtx });
|
||||
}
|
||||
return { perLanguage };
|
||||
}
|
||||
|
||||
/**
|
||||
* The FinalizeHooks-compatible implementation. Dispatches on `fromFile`'s
|
||||
* extension → per-language resolver. Returns the first resolved file,
|
||||
* or `null` if the resolver returns `null` or doesn't know about the
|
||||
* language.
|
||||
*
|
||||
* Picks the first entry of `files[]` for both `'files'` and `'package'`
|
||||
* result kinds — the legacy pipeline uses the whole array, but the
|
||||
* shared `finalize()` hook contract is single-file. If the workspace
|
||||
* later needs richer semantics (split-target packages), this is the
|
||||
* single site to extend.
|
||||
*/
|
||||
export function resolveImportTargetAcrossLanguages(
|
||||
targetRaw: string,
|
||||
fromFile: string,
|
||||
workspaceIndex: WorkspaceIndex,
|
||||
): string | null {
|
||||
const workspace = workspaceIndex as ImportTargetWorkspace | undefined;
|
||||
if (workspace === undefined || workspace.perLanguage === undefined) return null;
|
||||
|
||||
const lang = getLanguageFromFilename(fromFile);
|
||||
if (lang === null) return null;
|
||||
|
||||
const entry = workspace.perLanguage.get(lang);
|
||||
if (entry === undefined) return null;
|
||||
|
||||
let result: ImportResult;
|
||||
try {
|
||||
result = entry.resolver(targetRaw, fromFile, entry.ctx);
|
||||
} catch {
|
||||
// Existing resolvers can throw on malformed inputs (e.g., Python
|
||||
// relative paths above the workspace root). Swallow — the shared
|
||||
// algorithm treats a null here as `linkStatus: 'unresolved'`, which
|
||||
// is the right fallback.
|
||||
return null;
|
||||
}
|
||||
if (result === null) return null;
|
||||
|
||||
// Both `files` and `package` variants expose a `files` array; the
|
||||
// package variant also carries `dirSuffix` which we ignore at the
|
||||
// FinalizeHook boundary (single-file contract). Legacy consumers
|
||||
// continue to see the full result via `importResolver` directly.
|
||||
const first = result.files[0];
|
||||
return first ?? null;
|
||||
}
|
||||
|
|
@ -21,12 +21,6 @@ export interface TsconfigPaths {
|
|||
baseUrl: string;
|
||||
}
|
||||
|
||||
/** Go module config parsed from go.mod */
|
||||
export interface GoModuleConfig {
|
||||
/** Module path (e.g., "github.com/user/repo") */
|
||||
modulePath: string;
|
||||
}
|
||||
|
||||
/** PHP Composer PSR-4 autoload config */
|
||||
export interface ComposerConfig {
|
||||
/** Map of namespace prefix -> directory (e.g., "App\\" -> "app/") */
|
||||
|
|
@ -161,11 +155,7 @@ export interface CSharpProjectScan {
|
|||
readonly truncated: boolean;
|
||||
}
|
||||
|
||||
/** Project the one-pass {@link CSharpProjectScan} into the
|
||||
* {@link CSharpNamespaceEvidence} both import-resolution legs thread to the
|
||||
* #1881 gate — one shape, two carriers (`ImportConfigs.csharpNamespaces` for
|
||||
* the legacy DAG, `CsharpResolutionConfig.namespaces` for the scope resolver).
|
||||
* Keeps the field mapping in one place so the two carriers can't drift. */
|
||||
/** Project a workspace scan into the namespace evidence used by import resolution. */
|
||||
export function csharpScanToEvidence(scan: CSharpProjectScan): CSharpNamespaceEvidence {
|
||||
return {
|
||||
declaredNamespaces: scan.declaredNamespaces,
|
||||
|
|
@ -410,26 +400,6 @@ export async function loadTsconfigPaths(repoRoot: string): Promise<TsconfigPaths
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse go.mod to extract module path.
|
||||
*/
|
||||
export async function loadGoModulePath(repoRoot: string): Promise<GoModuleConfig | null> {
|
||||
try {
|
||||
const goModPath = path.join(repoRoot, 'go.mod');
|
||||
const content = await fs.readFile(goModPath, 'utf-8');
|
||||
const match = content.match(/^module\s+(\S+)/m);
|
||||
if (match) {
|
||||
if (isDev) {
|
||||
logger.info(`📦 Loaded Go module path: ${match[1]}`);
|
||||
}
|
||||
return { modulePath: match[1] };
|
||||
}
|
||||
} catch {
|
||||
// No go.mod
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Parse composer.json to extract PSR-4 autoload mappings (including autoload-dev). */
|
||||
export async function loadComposerConfig(repoRoot: string): Promise<ComposerConfig | null> {
|
||||
try {
|
||||
|
|
@ -466,9 +436,8 @@ const CSHARP_ROOT_NAMESPACE_RE = /<RootNamespace>\s*([^<]+)\s*<\/RootNamespace>/
|
|||
// scanner shared with the scope-resolution namespace-siblings pass
|
||||
// (`extractCsharpStructureViaScanner`), not a bare regex: a regex matches
|
||||
// `namespace` inside comments and string literals, seeding the #1881 gate
|
||||
// with phantom namespaces. Imported lazily (and memoized) so the always-on
|
||||
// `loadImportConfigs` path — every repo, every language — doesn't eagerly
|
||||
// pull tree-sitter-c-sharp in via `namespace-siblings.ts` → `query.ts`.
|
||||
// with phantom namespaces. Imported lazily (and memoized) so loading unrelated
|
||||
// configs does not pull tree-sitter-c-sharp in via namespace-siblings.ts.
|
||||
let csharpScannerFactoryPromise: Promise<() => CsharpStructureLineScanner> | undefined;
|
||||
function getCsharpStructureScannerFactory(): Promise<() => CsharpStructureLineScanner> {
|
||||
if (csharpScannerFactoryPromise === undefined) {
|
||||
|
|
@ -1925,10 +1894,7 @@ export function zigPackageFor(
|
|||
*
|
||||
* Called from `ScopeResolver.loadResolutionConfig`, which the orchestrator runs
|
||||
* once per LANGUAGE workspace pass — so the walk happens only for repos that
|
||||
* actually contain Zig. `loadImportConfigs`, which runs unconditionally for
|
||||
* every repo, keeps calling `loadZigBuildConfig` for the root package alone;
|
||||
* that is the same split TypeScript already has between the cheap
|
||||
* `loadTsconfigPaths` and the repo-walking `loadTsconfigIndex`.
|
||||
* actually contain Zig.
|
||||
*/
|
||||
export async function loadZigWorkspaceIndex(repoRoot: string): Promise<ZigWorkspaceIndex | null> {
|
||||
const dirs = await findZigPackageDirs(repoRoot);
|
||||
|
|
@ -2611,45 +2577,3 @@ export function parseZigBuildZon(raw: string): ZigBuildZonConfig | null {
|
|||
}
|
||||
return { pathDeps };
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// BUNDLED CONFIG LOADER
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* Bundled language-specific configs loaded once per ingestion run — the
|
||||
* result of {@link loadImportConfigs}, and every field's type is declared
|
||||
* above in this module.
|
||||
*
|
||||
* It lives here rather than in `import-resolvers/types.ts` (its consumer, via
|
||||
* `ResolveCtx`) so the dependency runs one way: the import-resolver types
|
||||
* import this bundle, and this module imports nothing from them. Homing the
|
||||
* producer's result type with the producer also keeps `import-resolvers/
|
||||
* types.ts` free of per-language names.
|
||||
*/
|
||||
export interface ImportConfigs {
|
||||
tsconfigPaths: TsconfigPaths | null;
|
||||
goModule: GoModuleConfig | null;
|
||||
composerConfig: ComposerConfig | null;
|
||||
swiftPackageConfig: SwiftPackageConfig | null;
|
||||
csharpConfigs: CSharpProjectConfig[];
|
||||
/** In-repo namespace evidence gating C# suffix-fallback resolution (#1881). */
|
||||
csharpNamespaces?: CSharpNamespaceEvidence;
|
||||
/** Zig `.path` deps from build.zig.zon. Optional so call sites that
|
||||
* hand-build ImportConfigs (tests) don't have to supply it. */
|
||||
zigBuildZon?: ZigBuildZonConfig | null;
|
||||
}
|
||||
|
||||
/** Load all language-specific configs once for an ingestion run. */
|
||||
export async function loadImportConfigs(repoRoot: string): Promise<ImportConfigs> {
|
||||
const csharpScan = await scanCSharpProject(repoRoot);
|
||||
return {
|
||||
tsconfigPaths: await loadTsconfigPaths(repoRoot),
|
||||
goModule: await loadGoModulePath(repoRoot),
|
||||
composerConfig: await loadComposerConfig(repoRoot),
|
||||
swiftPackageConfig: await loadSwiftPackageConfig(repoRoot),
|
||||
csharpConfigs: csharpScan.configs,
|
||||
csharpNamespaces: csharpScanToEvidence(csharpScan),
|
||||
zigBuildZon: await loadZigBuildConfig(repoRoot),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import type { ExportChecker } from './export-detection.js';
|
|||
import type { FieldExtractor } from './field-extractor.js';
|
||||
import type { MethodExtractor } from './method-types.js';
|
||||
import type { VariableExtractor } from './variable-types.js';
|
||||
import type { ImportResolverFn } from './import-resolvers/types.js';
|
||||
import type { SyntaxNode } from './utils/ast-helpers.js';
|
||||
import type { CfgVisitor } from './cfg/types.js';
|
||||
import type { CollectedCfgs } from './cfg/collect.js';
|
||||
|
|
@ -366,8 +365,6 @@ interface LanguageProviderConfig {
|
|||
readonly typeConfig: LanguageTypeConfig;
|
||||
/** Export detection: is this AST node a public/exported symbol? */
|
||||
readonly exportChecker: ExportChecker;
|
||||
/** Import resolution: resolves raw import path to file system path */
|
||||
readonly importResolver: ImportResolverFn;
|
||||
|
||||
// ── Calls & Imports (optional) ────────────────────────────────────
|
||||
/** Call routing for languages that express imports/heritage as calls (e.g., Ruby).
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ import { defineLanguage } from '../language-provider.js';
|
|||
import type { AstFrameworkPatternConfig } from '../language-provider.js';
|
||||
import { typeConfig as cCppConfig } from '../type-extractors/c-cpp.js';
|
||||
import { cCppExportChecker } from '../export-detection.js';
|
||||
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
||||
import { cImportConfig, cppImportConfig } from '../import-resolvers/configs/c-cpp.js';
|
||||
import { C_QUERIES, CPP_QUERIES } from '../tree-sitter-queries.js';
|
||||
|
||||
/**
|
||||
|
|
@ -397,7 +395,6 @@ export const cProvider = defineLanguage({
|
|||
`,
|
||||
typeConfig: cCppConfig,
|
||||
exportChecker: cCppExportChecker,
|
||||
importResolver: createImportResolver(cImportConfig),
|
||||
callExtractor: createCallExtractor(cCallConfig),
|
||||
fieldExtractor: createFieldExtractor(cFieldConfig),
|
||||
methodExtractor: createMethodExtractor({
|
||||
|
|
@ -492,7 +489,6 @@ export const cppProvider = defineLanguage({
|
|||
preprocessSource: stripUeMacros,
|
||||
typeConfig: cCppConfig,
|
||||
exportChecker: cCppExportChecker,
|
||||
importResolver: createImportResolver(cppImportConfig),
|
||||
mroStrategy: 'leftmost-base',
|
||||
callExtractor: createCallExtractor(cppCallConfig),
|
||||
fieldExtractor: createFieldExtractor(cppFieldConfig),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { dirname, join } from 'path';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
import {
|
||||
collapseRepoPath,
|
||||
nearestScope,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
} from './resolution-config.js';
|
||||
import { expandCWildcardNames, isStaticName, clearStaticNames } from './static-linkage.js';
|
||||
import { applyCStaticLinkageSideChannel } from './capture-side-channel.js';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
|
||||
/**
|
||||
* Per-pass memo of the augmented `#include`-resolution file set
|
||||
|
|
@ -35,8 +35,7 @@ import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
|||
* byte-identical. The augmented set's IDENTITY is load-bearing downstream —
|
||||
* C++ delegates to `resolveCImportTarget`, whose `suffixIndex` memo is keyed on
|
||||
* exactly this set — so one memo shared across the two languages would hand
|
||||
* each the other's index. Same builder-shared/memo-separate rule as
|
||||
* `import-resolvers/pass-cache.ts`.
|
||||
* each the other's index. Sharing a builder must not share its memo.
|
||||
*/
|
||||
const augmentedFilePathsFor = perFileSet((allFilePaths: ReadonlySet<string>) =>
|
||||
perFileSet((headerPaths: ReadonlySet<string>): ReadonlySet<string> => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { ParsedFile, ScopeId, SymbolDefinition } from 'gitnexus-shared';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
|
||||
/**
|
||||
* Per-file set of function names declared with `static` storage class.
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ export const cobolProvider = defineLanguage({
|
|||
extractParameter: () => null,
|
||||
},
|
||||
exportChecker: () => false,
|
||||
importResolver: () => null,
|
||||
rename: cobolRenameProvider,
|
||||
|
||||
// Standalone source provider: program regions preserve paragraph fallthrough
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
* per-name arrays, so a pass still scans the set once.
|
||||
*/
|
||||
import path from 'node:path';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
|
||||
const COPYBOOK_EXTENSIONS = new Set(['.cpy', '.copybook']);
|
||||
const COBOL_SOURCE_EXTENSIONS = new Set(['.cbl', '.cob', '.cobol']);
|
||||
|
|
|
|||
|
|
@ -224,6 +224,11 @@ export function emitCppScopeCaptures(
|
|||
}
|
||||
if (Object.keys(grouped).length === 0) continue;
|
||||
|
||||
if (grouped['@import.namespace-alias'] !== undefined) {
|
||||
recordCppUsingDeclaration(filePath, grouped);
|
||||
continue;
|
||||
}
|
||||
|
||||
// ── Handle #include statements ──────────────────────────────────
|
||||
// `@import.statement` is captured directly on the `preproc_include` node.
|
||||
if (grouped['@import.statement'] !== undefined) {
|
||||
|
|
@ -237,6 +242,19 @@ export function emitCppScopeCaptures(
|
|||
}
|
||||
}
|
||||
|
||||
const callable = nodeIfType(
|
||||
nodeMap['@declaration.function'] ?? nodeMap['@declaration.method'],
|
||||
'function_definition',
|
||||
);
|
||||
if (callable?.parent?.type === 'template_declaration') {
|
||||
const parameters = callable.parent.childForFieldName('parameters');
|
||||
if (parameters !== null)
|
||||
grouped['@declaration.type-parameters'] = nodeToCapture(
|
||||
'@declaration.type-parameters',
|
||||
parameters,
|
||||
);
|
||||
}
|
||||
|
||||
// ── Handle using declarations (using namespace / using name) ────
|
||||
// `@import.using-decl` is captured directly on the `using_declaration` node.
|
||||
if (grouped['@import.using-decl'] !== undefined) {
|
||||
|
|
@ -606,6 +624,17 @@ export function emitCppScopeCaptures(
|
|||
grouped['@type-binding.type'] = nodeToCapture('@type-binding.type', fieldNode);
|
||||
delete grouped['@type-binding.assignment'];
|
||||
}
|
||||
} else if (fnNode !== null && isCppQualifiedCallee(fnNode)) {
|
||||
// auto x = rp::make() / auto x = rp::C() → bind the QUALIFIED
|
||||
// callee, as `auto x = make()` binds `make` (the constructor rule
|
||||
// in query.ts matches only a bare identifier callee). Left alone,
|
||||
// the match bound `x` to the literal type `auto`. The resolver
|
||||
// types `x` from the class the spelling names, or from the
|
||||
// return type the callee's definition declares
|
||||
// (ScopeResolver.splitQualifiedCallee).
|
||||
grouped['@type-binding.constructor'] = anchor;
|
||||
grouped['@type-binding.type'] = nodeToCapture('@type-binding.type', fnNode);
|
||||
delete grouped['@type-binding.assignment'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -613,6 +642,17 @@ export function emitCppScopeCaptures(
|
|||
}
|
||||
}
|
||||
|
||||
// A prototype's return type (`D makeD();`) is a module-level fact only at
|
||||
// namespace scope. In a function body the same syntax declares a
|
||||
// block-scope function — the most vexing parse, `D x();` — and its binding
|
||||
// would be hoisted to the module and type every undeclared `x` in the file.
|
||||
// Only the prototype rules anchor `@type-binding.return` on a `declaration`
|
||||
// (definitions anchor on `function_definition`, in-class prototypes on
|
||||
// `field_declaration`), and the match carries nothing else, so it is dropped
|
||||
// whole.
|
||||
const prototypeReturn = nodeIfType(nodeMap['@type-binding.return'], 'declaration');
|
||||
if (prototypeReturn !== null && !isCppNamespaceScopeDeclaration(prototypeReturn)) continue;
|
||||
|
||||
const parameterNode = nodeMap['@type-binding.parameter'];
|
||||
const parameterCapture = grouped['@type-binding.parameter'];
|
||||
if (parameterNode !== undefined && parameterCapture !== undefined) {
|
||||
|
|
@ -655,6 +695,48 @@ export function emitCppScopeCaptures(
|
|||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* A `qualified_identifier` callee naming a plain function or class — `rp::make`,
|
||||
* `a::b::make`, `rp::C` — as opposed to a template call (`std::make_shared<T>`,
|
||||
* typed by its own rule in query.ts), an operator or a destructor.
|
||||
*/
|
||||
function isCppQualifiedCallee(node: SyntaxNode): boolean {
|
||||
if (node.type !== 'qualified_identifier') return false;
|
||||
let name = node.childForFieldName('name');
|
||||
while (name !== null && name.type === 'qualified_identifier') {
|
||||
name = name.childForFieldName('name');
|
||||
}
|
||||
return name !== null && name.type === 'identifier';
|
||||
}
|
||||
|
||||
/** Nodes a namespace-scope declaration may sit inside without leaving namespace
|
||||
* scope: preprocessor conditionals (include guards nest every declaration of a
|
||||
* guarded header in one), single-declaration `extern "C"`, and a `template`
|
||||
* prefix. */
|
||||
const CPP_NAMESPACE_SCOPE_WRAPPERS: ReadonlySet<string> = new Set([
|
||||
'preproc_if',
|
||||
'preproc_ifdef',
|
||||
'preproc_else',
|
||||
'preproc_elif',
|
||||
'preproc_elifdef',
|
||||
'linkage_specification',
|
||||
'template_declaration',
|
||||
]);
|
||||
|
||||
/**
|
||||
* Is `node` declared at namespace scope — directly in the translation unit or in
|
||||
* a namespace / `extern "C" {}` body (`declaration_list`), through any number of
|
||||
* {@link CPP_NAMESPACE_SCOPE_WRAPPERS}? A function body, class body, friend
|
||||
* declaration or anything else on the way up answers no.
|
||||
*/
|
||||
function isCppNamespaceScopeDeclaration(node: SyntaxNode): boolean {
|
||||
for (let parent = node.parent; parent !== null; parent = parent.parent) {
|
||||
if (parent.type === 'translation_unit' || parent.type === 'declaration_list') return true;
|
||||
if (!CPP_NAMESPACE_SCOPE_WRAPPERS.has(parent.type)) return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Prototype and nested function-pointer parameter names do not bind the body. */
|
||||
function isCppLexicalParameter(node: SyntaxNode): boolean {
|
||||
for (let parent = node.parent; parent !== null; parent = parent.parent) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { ParsedFile, Scope, ScopeId, SymbolDefinition } from 'gitnexus-shared';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
import { isCppInlineNamespaceScope } from './inline-namespaces.js';
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@
|
|||
* declaration transparently.
|
||||
*/
|
||||
|
||||
import type { Callsite, ParsedFile, ScopeId, SymbolDefinition } from 'gitnexus-shared';
|
||||
import type { Callsite, ParsedFile, ScopeId, SymbolDefinition, TypeRef } from 'gitnexus-shared';
|
||||
import { isCppNamespaceQualifierShadowed } from './qualified-name-claims.js';
|
||||
import type { ScopeResolutionIndexes } from '../../model/scope-resolution-indexes.js';
|
||||
import {
|
||||
isOverloadAmbiguousAfterNormalization,
|
||||
|
|
@ -182,6 +183,7 @@ interface QualifiedNsMemberIndex {
|
|||
* for are ever materialized, which is what keeps the deep-chain case linear.
|
||||
*/
|
||||
readonly membersByReceiver: Map<string, Map<string, readonly SymbolDefinition[]>>;
|
||||
readonly ownerScopeByDefId: ReadonlyMap<string, ScopeId>;
|
||||
}
|
||||
|
||||
/** One `Namespace` scope as the qualified-lookup walk sees it. */
|
||||
|
|
@ -271,6 +273,7 @@ interface MemoizedIndex {
|
|||
* pairs it already found. */
|
||||
function buildQualifiedNsMemberIndex(parsedFiles: readonly ParsedFile[]): QualifiedNsMemberIndex {
|
||||
const rootsByReceiver = new Map<string, QualifiedNsNode[]>();
|
||||
const ownerScopeByDefId = new Map<string, ScopeId>();
|
||||
|
||||
for (const parsed of parsedFiles) {
|
||||
const nodesByScope = new Map<ScopeId, MutableNsNode>();
|
||||
|
|
@ -278,6 +281,8 @@ function buildQualifiedNsMemberIndex(parsedFiles: readonly ParsedFile[]): Qualif
|
|||
for (const sc of parsed.scopes) {
|
||||
if (sc.kind !== 'Namespace') continue;
|
||||
const node: MutableNsNode = { ownMembers: bucketOwnMembers(sc), inlineChildren: [] };
|
||||
for (const definitions of node.ownMembers.values())
|
||||
for (const definition of definitions) ownerScopeByDefId.set(definition.nodeId, sc.id);
|
||||
nodesByScope.set(sc.id, node);
|
||||
namespaces.push([sc, node]);
|
||||
}
|
||||
|
|
@ -299,7 +304,7 @@ function buildQualifiedNsMemberIndex(parsedFiles: readonly ParsedFile[]): Qualif
|
|||
roots.push(node);
|
||||
}
|
||||
}
|
||||
return { rootsByReceiver, membersByReceiver: new Map() };
|
||||
return { rootsByReceiver, membersByReceiver: new Map(), ownerScopeByDefId };
|
||||
}
|
||||
|
||||
/** Bucket a namespace scope's own callable `ownedDefs` by member simple name.
|
||||
|
|
@ -450,10 +455,50 @@ export function resolveCppQualifiedNamespaceMember(
|
|||
receiverName: string,
|
||||
memberName: string,
|
||||
parsedFiles: readonly ParsedFile[],
|
||||
_scopes: ScopeResolutionIndexes,
|
||||
scopes: ScopeResolutionIndexes,
|
||||
callsite?: Callsite,
|
||||
callerScope?: ScopeId,
|
||||
): SymbolDefinition | 'ambiguous' | undefined {
|
||||
const allHits = qualifiedNsMembers(qualifiedNsMemberIndex(parsedFiles), receiverName, memberName);
|
||||
const index = qualifiedNsMemberIndex(parsedFiles);
|
||||
const qualifier = receiverName.replace(/^::/, '').replace(/::/g, '.');
|
||||
const qualified = receiverName.includes('::');
|
||||
const receiver = qualifier.slice(qualifier.lastIndexOf('.') + 1);
|
||||
let allHits = qualifiedNsMembers(index, receiver, memberName);
|
||||
if (qualified) {
|
||||
const prefixes: string[] = [];
|
||||
let cursor = callerScope === undefined ? undefined : scopes.scopeTree.getScope(callerScope);
|
||||
const visited = new Set<ScopeId>();
|
||||
while (cursor !== undefined && !visited.has(cursor.id)) {
|
||||
visited.add(cursor.id);
|
||||
if (cursor.kind === 'Namespace') {
|
||||
const definition = findNamespaceDefInScope(cursor);
|
||||
if (definition !== undefined) prefixes.unshift(simpleNameOf(definition));
|
||||
}
|
||||
cursor = cursor.parent === null ? undefined : scopes.scopeTree.getScope(cursor.parent);
|
||||
}
|
||||
const keys = new Set([qualifier]);
|
||||
if (!receiverName.startsWith('::'))
|
||||
for (let length = prefixes.length; length > 0; length--)
|
||||
keys.add([...prefixes.slice(0, length), qualifier].join('.'));
|
||||
allHits = allHits.filter((definition) => {
|
||||
if (definition.namespacePrefix !== undefined && keys.has(definition.namespacePrefix))
|
||||
return true;
|
||||
const transparent: string[] = [];
|
||||
let id = index.ownerScopeByDefId.get(definition.nodeId);
|
||||
const seen = new Set<ScopeId>();
|
||||
while (id !== undefined && !seen.has(id)) {
|
||||
seen.add(id);
|
||||
const scope = scopes.scopeTree.getScope(id);
|
||||
if (scope === undefined) break;
|
||||
if (scope.kind === 'Namespace' && !isCppInlineNamespaceScope(id)) {
|
||||
const namespace = findNamespaceDefInScope(scope);
|
||||
if (namespace !== undefined) transparent.unshift(simpleNameOf(namespace));
|
||||
}
|
||||
id = scope.parent ?? undefined;
|
||||
}
|
||||
return keys.has(transparent.join('.'));
|
||||
});
|
||||
}
|
||||
if (allHits.length === 0) return undefined;
|
||||
if (allHits.length === 1) return allHits[0];
|
||||
|
||||
|
|
@ -476,6 +521,47 @@ export function resolveCppQualifiedNamespaceMember(
|
|||
return 'ambiguous';
|
||||
}
|
||||
|
||||
/**
|
||||
* `ScopeResolver.splitQualifiedCallee` for C++: the receiver/member pair the
|
||||
* qualified-call captures produce for a callee spelling, so
|
||||
* {@link resolveCppQualifiedNamespaceMember} answers it exactly as it answers
|
||||
* the call. The full written qualifier is retained
|
||||
* (`a::b::make()` → `a::b` / `make`) so another outer namespace cannot supply
|
||||
* the result type. Separators inside template
|
||||
* arguments are not split points (`ns::Box<a::B>::make` → `ns::Box<a::B>` / `make`,
|
||||
* which names no namespace and resolves nothing). Unqualified → `undefined`.
|
||||
*/
|
||||
export function splitCppQualifiedCallee(
|
||||
callee: string,
|
||||
callerScope?: ScopeId,
|
||||
scopes?: ScopeResolutionIndexes,
|
||||
position?: TypeRef['lookupPosition'],
|
||||
): { readonly receiver: string; readonly member: string } | undefined {
|
||||
if (callerScope !== undefined && scopes !== undefined && !/^\s*::/.test(callee)) {
|
||||
const root = callee.trim().split('::')[0]?.trim();
|
||||
if (root !== undefined) {
|
||||
if (isCppNamespaceQualifierShadowed(root, callerScope, scopes, position)) return undefined;
|
||||
}
|
||||
}
|
||||
const separators: number[] = [];
|
||||
let angleDepth = 0;
|
||||
for (let i = 0; i < callee.length; i++) {
|
||||
const ch = callee[i];
|
||||
if (ch === '<') angleDepth++;
|
||||
else if (ch === '>') {
|
||||
if (angleDepth > 0) angleDepth--;
|
||||
} else if (angleDepth === 0 && ch === ':' && callee[i + 1] === ':') {
|
||||
separators.push(i);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
const last = separators[separators.length - 1];
|
||||
if (last === undefined) return undefined;
|
||||
const receiver = callee.slice(0, last).trim();
|
||||
const member = callee.slice(last + 2).trim();
|
||||
return receiver.length > 0 && member.length > 0 ? { receiver, member } : undefined;
|
||||
}
|
||||
|
||||
function findNamespaceDefInScope(scope: {
|
||||
readonly ownedDefs: readonly SymbolDefinition[];
|
||||
}): SymbolDefinition | undefined {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ export function interpretCppImport(captures: CaptureMatch): ParsedImport | null
|
|||
return { kind: 'wildcard', targetRaw: source, isSystem };
|
||||
}
|
||||
|
||||
/** Placeholder type specifiers: the declared type is deduced, never named. */
|
||||
const CPP_PLACEHOLDER_TYPES: ReadonlySet<string> = new Set(['auto', 'decltype(auto)']);
|
||||
|
||||
/**
|
||||
* Interpret a C++ type-binding capture into a ParsedTypeBinding.
|
||||
*
|
||||
|
|
@ -51,6 +54,12 @@ export function interpretCppTypeBinding(captures: CaptureMatch): ParsedTypeBindi
|
|||
const name = captures['@type-binding.name']?.text;
|
||||
const type = captures['@type-binding.type']?.text;
|
||||
if (name === undefined || type === undefined) return null;
|
||||
// `auto` names no type: the deduced type is whatever the initializer yields,
|
||||
// which the specific rules (constructor, alias, member access, qualified
|
||||
// callee) capture directly. What reaches here as `auto` is a leftover —
|
||||
// `auto n = 5;`, `[](auto v)` — and binding it records the literal type name
|
||||
// `auto`, which types nothing and hides the variable from every other route.
|
||||
if (CPP_PLACEHOLDER_TYPES.has(type.trim())) return null;
|
||||
|
||||
let source: TypeRef['source'] = 'annotation';
|
||||
|
||||
|
|
@ -85,17 +94,24 @@ export function interpretCppTypeBinding(captures: CaptureMatch): ParsedTypeBindi
|
|||
// A member field's type is captured AS WRITTEN, qualifier and all
|
||||
// (`ns::Repo<User>`), because the query matches the outer
|
||||
// `qualified_identifier` — one depth-agnostic pattern per declarator shape
|
||||
// instead of one per qualifier depth. The qualifier is dropped HERE; see the
|
||||
// "Field type, QUALIFIED" block in query.ts for why the qualified spelling
|
||||
// resolves to nothing and the tail resolves like the bare one.
|
||||
// instead of one per qualifier depth.
|
||||
//
|
||||
// FIELDS ONLY. `@type-binding.parameter` and `@type-binding.assignment` also
|
||||
// capture qualified spellings (their patterns use `type: (_)`), and reducing
|
||||
// THOSE would newly bind every qualified local and parameter in the workspace
|
||||
// — a far wider change than the member-field miss this closes, and not one
|
||||
// anything here has measured.
|
||||
// A NON-GENERIC qualified member (`a::Config cfg;`) keeps its qualifier, like
|
||||
// a qualified local or parameter: the resolver matches the qualifier against
|
||||
// the candidate's namespace (`ScopeResolver.resolveQualifiedTypeSpellings`).
|
||||
// Its tail bound the NEAREST `Config` — inside a `namespace b` that declares
|
||||
// one, `cfg.m()` reached `b::Config::m`, a confident wrong edge.
|
||||
//
|
||||
// A GENERIC qualified member is still reduced to its tail, here, because the
|
||||
// template-argument match that picks a specialization (`Repo<User>` over the
|
||||
// primary `Repo<T>`) keys on the bare base name; the qualified route is
|
||||
// argument-blind and would refuse wherever a specialization exists. See the
|
||||
// "Field type, QUALIFIED" block in query.ts. That keeps the tail hazard for
|
||||
// generic members, and only for them.
|
||||
const effectiveType =
|
||||
captures['@type-binding.field'] === undefined ? type : cppQualifiedTail(type);
|
||||
captures['@type-binding.field'] !== undefined && type.includes('<')
|
||||
? cppQualifiedTail(type)
|
||||
: type;
|
||||
// The reduced spelling is also the AS-WRITTEN one, and saying so is load
|
||||
// bearing. `collectTypeBindings` derives `TypeRef.declaredSpelling` from
|
||||
// `@type-binding.type` whenever that text differs from `rawTypeName`, and it
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
import type { Range, ScopeId } from 'gitnexus-shared';
|
||||
import type { ScopeResolutionIndexes } from '../../model/scope-resolution-indexes.js';
|
||||
import { bindsTypeParameter, isClassLike } from '../../scope-resolution/scope/walkers.js';
|
||||
|
||||
/** Check lexical owners, excluding the finalize channel's hoisted declarations. */
|
||||
export function isCppNamespaceQualifierShadowed(
|
||||
name: string,
|
||||
inScope: ScopeId,
|
||||
indexes: ScopeResolutionIndexes,
|
||||
position?: Pick<Range, 'startLine' | 'startCol'>,
|
||||
): boolean {
|
||||
if (bindsTypeParameter(inScope, name, indexes)) return true;
|
||||
const seen = new Set<ScopeId>();
|
||||
let id: ScopeId | null = inScope;
|
||||
while (id !== null && !seen.has(id)) {
|
||||
seen.add(id);
|
||||
const scope = indexes.scopeTree.getScope(id);
|
||||
if (scope === undefined) break;
|
||||
if (
|
||||
scope.bindings.get(name)?.some((binding) => {
|
||||
if (
|
||||
!isClassLike(binding.def.type) &&
|
||||
binding.def.type !== 'Typedef' &&
|
||||
binding.def.type !== 'TypeAlias'
|
||||
)
|
||||
return false;
|
||||
const at =
|
||||
binding.availableFrom ?? binding.declarationRange ?? binding.def.declarationRange;
|
||||
return (
|
||||
position === undefined ||
|
||||
at === undefined ||
|
||||
scope.kind === 'Class' ||
|
||||
at.startLine < position.startLine ||
|
||||
(at.startLine === position.startLine && at.startCol <= position.startCol)
|
||||
);
|
||||
})
|
||||
)
|
||||
return true;
|
||||
id = scope.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -264,6 +264,10 @@ const CPP_SCOPE_QUERY = `
|
|||
(type_definition
|
||||
declarator: (type_identifier) @declaration.name) @declaration.typedef
|
||||
|
||||
(namespace_alias_definition
|
||||
name: (namespace_identifier) @import.name
|
||||
. (_) @import.source) @import.namespace-alias @import.statement
|
||||
|
||||
;; ─── Declarations — type alias (using Name = Type) ──────────────────
|
||||
(alias_declaration
|
||||
name: (type_identifier) @declaration.name) @declaration.typedef
|
||||
|
|
@ -383,6 +387,17 @@ const CPP_SCOPE_QUERY = `
|
|||
type: (template_type) @type-binding.type
|
||||
declarator: (identifier) @type-binding.name) @type-binding.annotation
|
||||
|
||||
;; Covers: rp::C x; std::vector<User> users;
|
||||
;; A QUALIFIED type is a qualified_identifier wrapping the type_identifier or
|
||||
;; template_type, so the two rules above never matched it and rp::C x; bound
|
||||
;; nothing — the receiver of x.m() was untyped. Matched on the OUTER node, one
|
||||
;; pattern per declarator shape like the qualified field rules below (depth- and
|
||||
;; genericity-agnostic, no alternation). The spelling is kept as written and
|
||||
;; resolved by the qualifier-aware route (resolveQualifiedTypeSpellings).
|
||||
(declaration
|
||||
type: (qualified_identifier) @type-binding.type
|
||||
declarator: (identifier) @type-binding.name) @type-binding.annotation
|
||||
|
||||
;; ─── Type bindings — pointer variable declaration ───────────────────
|
||||
;; Covers: User* ptr = new User()
|
||||
(declaration
|
||||
|
|
@ -391,6 +406,13 @@ const CPP_SCOPE_QUERY = `
|
|||
declarator: (pointer_declarator
|
||||
declarator: (identifier) @type-binding.name))) @type-binding.annotation
|
||||
|
||||
;; Covers: rp::C* ptr = nullptr; (the qualified twin of the rule above)
|
||||
(declaration
|
||||
type: (qualified_identifier) @type-binding.type
|
||||
declarator: (init_declarator
|
||||
declarator: (pointer_declarator
|
||||
declarator: (identifier) @type-binding.name))) @type-binding.annotation
|
||||
|
||||
;; ─── Type bindings — auto + constructor call ────────────────────────
|
||||
;; Covers: auto user = User("alice")
|
||||
;; AST: declaration > placeholder_type_specifier/auto > init_declarator > identifier + call_expression > identifier
|
||||
|
|
@ -414,13 +436,18 @@ const CPP_SCOPE_QUERY = `
|
|||
;; ─── Type bindings — auto + scoped brace-init (qualified) ───────────
|
||||
;; Covers: auto client = ns::HttpClient{}
|
||||
;; AST: compound_literal_expression > qualified_identifier > type_identifier
|
||||
;; The WHOLE qualified spelling is captured, not its tail: \`ns::HttpClient\` is
|
||||
;; resolved by the qualifier-aware route (\`resolveQualifiedTypeSpellings\`),
|
||||
;; while the tail \`HttpClient\` bound whichever same-named class was nearer — a
|
||||
;; global one through another include, or the enclosing namespace's own
|
||||
;; (\`auto x = a::Config{}\` inside a \`namespace b\` declaring Config). Matching
|
||||
;; the outer node is also depth-agnostic (\`a::b::T{}\`).
|
||||
(declaration
|
||||
type: (placeholder_type_specifier)
|
||||
declarator: (init_declarator
|
||||
declarator: (identifier) @type-binding.name
|
||||
value: (compound_literal_expression
|
||||
type: (qualified_identifier
|
||||
name: (type_identifier) @type-binding.type)))) @type-binding.constructor
|
||||
type: (qualified_identifier) @type-binding.type))) @type-binding.constructor
|
||||
|
||||
;; ─── Type bindings — auto + new expression ──────────────────────────
|
||||
;; Covers: auto user = new User(name)
|
||||
|
|
@ -488,20 +515,43 @@ const CPP_SCOPE_QUERY = `
|
|||
;; Covers: User getUser() { ... }
|
||||
;; AST: function_definition > type_identifier + function_declarator > identifier
|
||||
(function_definition
|
||||
type: (type_identifier) @type-binding.type
|
||||
type: [(type_identifier) (qualified_identifier)] @type-binding.type
|
||||
declarator: (function_declarator
|
||||
declarator: (identifier) @type-binding.name)) @type-binding.return
|
||||
|
||||
;; Return type — out-of-class method: User Class::getUser() { ... }
|
||||
(function_definition
|
||||
type: (type_identifier) @type-binding.type
|
||||
type: [(type_identifier) (qualified_identifier)] @type-binding.type
|
||||
declarator: (function_declarator
|
||||
declarator: (qualified_identifier
|
||||
name: (identifier) @type-binding.name))) @type-binding.return
|
||||
|
||||
;; Return type — pointer return: User* getUser() { ... }
|
||||
(function_definition
|
||||
type: (type_identifier) @type-binding.type
|
||||
type: [(type_identifier) (qualified_identifier)] @type-binding.type
|
||||
declarator: (pointer_declarator
|
||||
declarator: (function_declarator
|
||||
declarator: (identifier) @type-binding.name))) @type-binding.return
|
||||
|
||||
;; ─── Type bindings — free-function PROTOTYPE return type ─────────────
|
||||
;; Covers: D makeD(); D* makeDp(); namespace rp { C make(); }
|
||||
;; The usual layout is "header declares, .cpp defines", and a .cpp is never
|
||||
;; included — so the header prototype is the only return-type fact an includer
|
||||
;; can see. Only definitions carried one, which left \`auto x = makeD(); x.m()\`
|
||||
;; and \`makeD().m()\` untyped in every file that merely includes the header.
|
||||
;; Inside a function body the same syntax declares a BLOCK-scope function (the
|
||||
;; most vexing parse, \`D x();\`), whose binding would be hoisted to the module
|
||||
;; like any return type; captures.ts keeps only the matches at namespace scope
|
||||
;; (isCppNamespaceScopeDeclaration). A reference return (\`D& f();\`) has no
|
||||
;; rule here because such a function is not declared as a Function at all.
|
||||
(declaration
|
||||
type: [(type_identifier) (qualified_identifier)] @type-binding.type
|
||||
declarator: (function_declarator
|
||||
declarator: (identifier) @type-binding.name)) @type-binding.return
|
||||
|
||||
;; Prototype pointer return: D* makeDp();
|
||||
(declaration
|
||||
type: [(type_identifier) (qualified_identifier)] @type-binding.type
|
||||
declarator: (pointer_declarator
|
||||
declarator: (function_declarator
|
||||
declarator: (identifier) @type-binding.name))) @type-binding.return
|
||||
|
|
@ -509,13 +559,13 @@ const CPP_SCOPE_QUERY = `
|
|||
;; ─── Type bindings — inline method return type ──────────────────────
|
||||
;; Covers: class Foo { User getUser() { ... } };
|
||||
(function_definition
|
||||
type: (type_identifier) @type-binding.type
|
||||
type: [(type_identifier) (qualified_identifier)] @type-binding.type
|
||||
declarator: (function_declarator
|
||||
declarator: (field_identifier) @type-binding.name)) @type-binding.return
|
||||
|
||||
;; Inline method pointer return type: class Foo { User* lookup(int) { ... } };
|
||||
(function_definition
|
||||
type: (type_identifier) @type-binding.type
|
||||
type: [(type_identifier) (qualified_identifier)] @type-binding.type
|
||||
declarator: (pointer_declarator
|
||||
declarator: (function_declarator
|
||||
declarator: (field_identifier) @type-binding.name))) @type-binding.return
|
||||
|
|
@ -524,13 +574,13 @@ const CPP_SCOPE_QUERY = `
|
|||
;; Covers: class User { User* lookup(int); std::string getName(); };
|
||||
;; AST: field_declaration > function_declarator > field_identifier
|
||||
(field_declaration
|
||||
type: (type_identifier) @type-binding.type
|
||||
type: [(type_identifier) (qualified_identifier)] @type-binding.type
|
||||
declarator: (function_declarator
|
||||
declarator: (field_identifier) @type-binding.name)) @type-binding.return
|
||||
|
||||
;; Method prototype pointer return type: User* lookup(int id);
|
||||
(field_declaration
|
||||
type: (type_identifier) @type-binding.type
|
||||
type: [(type_identifier) (qualified_identifier)] @type-binding.type
|
||||
declarator: (pointer_declarator
|
||||
declarator: (function_declarator
|
||||
declarator: (field_identifier) @type-binding.name))) @type-binding.return
|
||||
|
|
@ -599,18 +649,16 @@ const CPP_SCOPE_QUERY = `
|
|||
;; a single node type in the field position, not an alternation — the
|
||||
;; tree-sitter 0.21 hazard this repo has been bitten by before.
|
||||
;;
|
||||
;; The QUALIFIER IS THEN DROPPED, by cppQualifiedTail in interpret.ts, not
|
||||
;; here — and dropping it was measured rather than assumed. Recording
|
||||
;; ns::Repo<User> resolves to NOTHING: findClassBindingInScope's dotted-tail
|
||||
;; fallback splits on "." and C++ writes "::", and resolveClassBindingForName's
|
||||
;; generic branch then looks up the base ns::Repo, which is not a key either
|
||||
;; because C++ emits no @declaration.qualified_name and indexes ns::Repo under
|
||||
;; Repo. Reducing to the tail lands on exactly the path the BARE spelling
|
||||
;; already takes — one class-like match or decline — so a qualified member field
|
||||
;; behaves like the bare one instead of like nothing. A tail that names no
|
||||
;; workspace class (std::string with no "class string" in the repo) binds
|
||||
;; nothing and emits nothing, which is why this is a miss-closing change rather
|
||||
;; than an edge-fabricating one.
|
||||
;; For a GENERIC member the QUALIFIER IS THEN DROPPED, by cppQualifiedTail in
|
||||
;; interpret.ts, not here. resolveClassBindingForName's template-argument match
|
||||
;; (the one that prefers a Repo<User> specialization over the primary Repo<T>)
|
||||
;; looks up the BASE name, and C++ indexes ns::Repo under Repo, so only the tail
|
||||
;; reaches it. A NON-GENERIC member keeps its qualifier and resolves through the
|
||||
;; qualifier-aware route (ScopeResolver.resolveQualifiedTypeSpellings): its tail
|
||||
;; bound the NEAREST same-named class, which inside a namespace declaring its
|
||||
;; own Config made a::Config cfg; type cfg as that one. A qualified spelling
|
||||
;; that names no workspace class (std::string with no namespace std in the
|
||||
;; repo) binds nothing and emits nothing.
|
||||
;;
|
||||
;; Like the six above, each requires the declarator to reach the field_identifier
|
||||
;; DIRECTLY, so a method whose return type is qualified (ns::Thing method();)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { ParsedFile, SymbolDefinition } from 'gitnexus-shared';
|
||||
import type { ParsedFile, SymbolDefinition, TypeRef } from 'gitnexus-shared';
|
||||
import {
|
||||
findClassBindingInScope,
|
||||
findEnclosingClassDef,
|
||||
|
|
@ -44,6 +44,7 @@ import {
|
|||
clearCppInlineNamespaces,
|
||||
populateCppInlineNamespaceScopes,
|
||||
resolveCppQualifiedNamespaceMember,
|
||||
splitCppQualifiedCallee,
|
||||
} from './inline-namespaces.js';
|
||||
import { populateCppRangeBindings } from './range-bindings.js';
|
||||
import { cppConstraintCompatibility } from './constraint-filter.js';
|
||||
|
|
@ -57,11 +58,12 @@ import {
|
|||
resolveCppReceiverMember,
|
||||
} from './member-lookup.js';
|
||||
import { stripCppSpecifiers } from './interpret.js';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
import {
|
||||
clearCppUsingDeclarations,
|
||||
populateCppIncludedUsingClaims,
|
||||
populateCppUsingBindings,
|
||||
cppQualifiedTypeLookupSpelling,
|
||||
} from './using-bindings.js';
|
||||
|
||||
/** A pointee worth binding: a bare identifier, not `T**`, `T[]`, `A::B` or a
|
||||
|
|
@ -85,8 +87,8 @@ const CPP_SIMPLE_POINTEE_RE = /^[A-Za-z_]\w*$/;
|
|||
* (Twin of the C resolver's `augmentedFilePathsFor`.) The two memos stay
|
||||
* SEPARATE deliberately. C++ delegates to `resolveCImportTarget`, whose
|
||||
* `suffixIndex` memo is keyed on the augmented set, so a single memo shared
|
||||
* with C would hand each language the other's index — same
|
||||
* builder-shared/memo-separate rule as `import-resolvers/pass-cache.ts`.
|
||||
* with C would hand each language the other's index. Sharing a builder must
|
||||
* not share its memo.
|
||||
*/
|
||||
const augmentedFilePathsFor = perFileSet((allFilePaths: ReadonlySet<string>) =>
|
||||
perFileSet((headerPaths: ReadonlySet<string>): ReadonlySet<string> => {
|
||||
|
|
@ -231,6 +233,26 @@ export const cppScopeResolver: ScopeResolver = {
|
|||
},
|
||||
|
||||
populateNamespaceSiblings: (parsedFiles, indexes) => {
|
||||
// Name-keyed return facts cannot choose between free overloads whose
|
||||
// return types differ. Keep their declaration identities, drop the guess.
|
||||
for (const parsed of parsedFiles) {
|
||||
for (const scope of parsed.scopes) {
|
||||
if (scope.kind !== 'Module' && scope.kind !== 'Namespace') continue;
|
||||
const returns = new Map<string, Set<string | undefined>>();
|
||||
for (const definition of scope.ownedDefs) {
|
||||
if (definition.type !== 'Function' || definition.qualifiedName === undefined) continue;
|
||||
const name = definition.qualifiedName.slice(
|
||||
definition.qualifiedName.lastIndexOf('.') + 1,
|
||||
);
|
||||
const types = returns.get(name) ?? new Set<string | undefined>();
|
||||
types.add(definition.returnType);
|
||||
returns.set(name, types);
|
||||
}
|
||||
for (const [name, types] of returns)
|
||||
if (types.size > 1 && scope.typeBindings.get(name)?.source === 'return-annotation')
|
||||
(scope.typeBindings as Map<string, TypeRef>).delete(name);
|
||||
}
|
||||
}
|
||||
populateCppUsingBindings(parsedFiles, indexes);
|
||||
populateCppIncludedOverloads(indexes);
|
||||
},
|
||||
|
|
@ -321,12 +343,18 @@ export const cppScopeResolver: ScopeResolver = {
|
|||
conversionOnlyArgTypePrefixes: CPP_CONVERSION_ONLY_ARG_TYPE_PREFIXES,
|
||||
// Range-for element type inference: for (auto& user : users) → bind user to User
|
||||
populateRangeBindings: populateCppRangeBindings,
|
||||
// C++ method return-type bindings need to be visible from module scope
|
||||
// for cross-file propagation and compound-receiver chain resolution.
|
||||
// cppBindingScopeFor hoists @type-binding.return to Module scope.
|
||||
hoistTypeBindingsToModule: true,
|
||||
// Return bindings stay with their declaring class or namespace. An absent
|
||||
// method fact must not borrow a same-name free function's return type.
|
||||
// Enable receiver-bound explicit-`this` fallback only for C++.
|
||||
resolveThisViaEnclosingClass: true,
|
||||
// `rp::C x`, `void f(a::Config c)`: the capture keeps the qualifier, and
|
||||
// neither `#include` (no namespace handle) nor the index (`rp::C` keyed as
|
||||
// `C`) lets the shared receiver lookups read it. Resolve it the way a
|
||||
// qualified base class already resolves — qualifier matched against the
|
||||
// candidate's namespace, refuse on a tie — rather than by its tail, which
|
||||
// binds the nearer same-named class the qualifier was written to exclude.
|
||||
resolveQualifiedTypeSpellings: true,
|
||||
qualifiedTypeLookupSpelling: cppQualifiedTypeLookupSpelling,
|
||||
resolveReceiverMember: resolveCppReceiverMember,
|
||||
// The `isFileLocalDef` hook on the global free-call fallback names
|
||||
// file-local linkage historically, but semantically gates "logically
|
||||
|
|
@ -396,9 +424,38 @@ export const cppScopeResolver: ScopeResolver = {
|
|||
resolveQualifiedReceiverMember: (
|
||||
receiverName,
|
||||
memberName,
|
||||
_callerScope,
|
||||
callerScope,
|
||||
scopes,
|
||||
parsedFiles,
|
||||
callsite,
|
||||
) => resolveCppQualifiedNamespaceMember(receiverName, memberName, parsedFiles, scopes, callsite),
|
||||
) =>
|
||||
resolveCppQualifiedNamespaceMember(
|
||||
receiverName,
|
||||
memberName,
|
||||
parsedFiles,
|
||||
scopes,
|
||||
callsite,
|
||||
callerScope,
|
||||
),
|
||||
// `auto x = rp::make(); x.m()` / `rp::make().m()`: map the callee text back
|
||||
// onto the receiver/member pair the call capture used, so the hook above
|
||||
// answers the factory's definition the way it answered the call.
|
||||
splitQualifiedCallee: (callee, callerScope, scopes, position) => {
|
||||
// The namespace-member resolver does not bind aliases. Decline instead
|
||||
// of treating an alias as an unrelated namespace with the same name.
|
||||
if (
|
||||
callerScope !== undefined &&
|
||||
cppQualifiedTypeLookupSpelling(
|
||||
{
|
||||
rawName: callee,
|
||||
declaredAtScope: callerScope,
|
||||
source: 'assignment-inferred',
|
||||
lookupPosition: position,
|
||||
},
|
||||
scopes,
|
||||
) !== undefined
|
||||
)
|
||||
return undefined;
|
||||
return splitCppQualifiedCallee(callee, callerScope, scopes, position);
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,17 +21,15 @@ export function cppBindingScopeFor(
|
|||
innermost: Scope,
|
||||
tree: ScopeTree,
|
||||
): ScopeId | null {
|
||||
// Hoist return-type bindings to Module scope so:
|
||||
// 1. propagateImportedReturnTypes can mirror them across files
|
||||
// 2. compound-receiver can find method return types via hoistTypeBindingsToModule
|
||||
// Keep each callable's return fact with its declaring owner. In particular,
|
||||
// a free prototype must not overwrite a same-name method's return type.
|
||||
if (decl['@type-binding.return'] !== undefined) {
|
||||
let cur: Scope | undefined = innermost;
|
||||
while (cur !== undefined && cur.kind !== 'Module') {
|
||||
const parentId: ScopeId | null = cur.parent ?? null;
|
||||
if (parentId === null) break;
|
||||
cur = tree.getScope(parentId);
|
||||
let current: Scope | undefined = innermost;
|
||||
while (current !== undefined) {
|
||||
if (current.kind === 'Class' || current.kind === 'Namespace' || current.kind === 'Module')
|
||||
return current.id;
|
||||
current = current.parent === null ? undefined : tree.getScope(current.parent);
|
||||
}
|
||||
if (cur !== undefined && cur.kind === 'Module') return cur.id;
|
||||
}
|
||||
return null; // default auto-hoist for other bindings
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,14 +8,18 @@ import type {
|
|||
Range,
|
||||
Scope,
|
||||
ScopeId,
|
||||
TypeRef,
|
||||
} from 'gitnexus-shared';
|
||||
import type { ScopeResolutionIndexes } from '../../model/scope-resolution-indexes.js';
|
||||
import { findClassBindingInScope, isClassLike } from '../../scope-resolution/scope/walkers.js';
|
||||
import { isCppInlineNamespaceScope } from './inline-namespaces.js';
|
||||
import { isCppNamespaceQualifierShadowed } from './qualified-name-claims.js';
|
||||
|
||||
/** Namespace lookup facts, deliberately distinct from preprocessor file imports. */
|
||||
export interface CppUsingDeclaration {
|
||||
readonly namespace: string;
|
||||
readonly name?: string;
|
||||
readonly alias?: string;
|
||||
readonly range: Range;
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +39,12 @@ export function recordCppUsingDeclaration(filePath: string, capture: CaptureMatc
|
|||
if (namespace === undefined || range === undefined) return;
|
||||
const name = capture['@import.name']?.text;
|
||||
const declarations = declarationsByFile.get(filePath) ?? [];
|
||||
declarations.push({ namespace, range, ...(name === undefined ? {} : { name }) });
|
||||
const alias = capture['@import.namespace-alias'] === undefined ? undefined : name;
|
||||
declarations.push({
|
||||
namespace,
|
||||
range,
|
||||
...(alias === undefined ? (name === undefined ? {} : { name }) : { alias }),
|
||||
});
|
||||
declarationsByFile.set(filePath, declarations);
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +101,7 @@ export function attachCppUsingClaims(captures: CaptureMatch[], filePath: string)
|
|||
byOwner.set(owner.match, claims);
|
||||
};
|
||||
for (const declaration of collectCppUsingDeclarations(filePath)) {
|
||||
if (declaration.name === undefined) continue;
|
||||
if (declaration.alias !== undefined || declaration.name === undefined) continue;
|
||||
add({
|
||||
name: declaration.name,
|
||||
range: declaration.range,
|
||||
|
|
@ -276,6 +285,7 @@ export function populateCppIncludedUsingClaims(
|
|||
for (const parsed of parsedFiles) {
|
||||
const declarations = usingDeclarations(parsed).filter(
|
||||
(declaration) =>
|
||||
declaration.alias === undefined &&
|
||||
declaration.name !== undefined &&
|
||||
owningScope(parsed, declaration.range)?.id === parsed.moduleScope,
|
||||
);
|
||||
|
|
@ -371,16 +381,166 @@ export function populateCppIncludedUsingClaims(
|
|||
}
|
||||
}
|
||||
|
||||
interface NamespaceAliasTarget {
|
||||
readonly target: string;
|
||||
readonly availableFrom?: Pick<Range, 'startLine' | 'startCol'>;
|
||||
}
|
||||
const namespaceAliases = new WeakMap<
|
||||
ScopeResolutionIndexes,
|
||||
Map<ScopeId, Map<string, NamespaceAliasTarget>>
|
||||
>();
|
||||
const classScopeIds = new WeakMap<ScopeResolutionIndexes, ReadonlyMap<string, ScopeId>>();
|
||||
|
||||
function visibleNamespaceAlias(
|
||||
name: string,
|
||||
inScope: ScopeId,
|
||||
indexes: ScopeResolutionIndexes,
|
||||
position?: Pick<Range, 'startLine' | 'startCol'>,
|
||||
): string | undefined {
|
||||
let id: ScopeId | null = inScope;
|
||||
const seen = new Set<ScopeId>();
|
||||
while (id !== null && !seen.has(id)) {
|
||||
seen.add(id);
|
||||
const alias = namespaceAliases.get(indexes)?.get(id)?.get(name);
|
||||
if (
|
||||
alias !== undefined &&
|
||||
(position === undefined ||
|
||||
alias.availableFrom === undefined ||
|
||||
compare(alias.availableFrom, position) <= 0)
|
||||
)
|
||||
return alias.target;
|
||||
const scope = indexes.scopeTree.getScope(id);
|
||||
if (
|
||||
scope?.bindings
|
||||
.get(name)
|
||||
?.some(
|
||||
(binding) =>
|
||||
binding.def.type === 'Namespace' &&
|
||||
(position === undefined ||
|
||||
binding.declarationRange === undefined ||
|
||||
compare(binding.declarationRange, position) <= 0),
|
||||
)
|
||||
)
|
||||
break;
|
||||
id = scope?.parent ?? null;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** Expand only aliases visible from the binding's declaration scope. */
|
||||
export function cppQualifiedTypeLookupSpelling(
|
||||
ref: TypeRef,
|
||||
indexes?: ScopeResolutionIndexes,
|
||||
): string | null | undefined {
|
||||
if (indexes === undefined) return undefined;
|
||||
const separator = ref.rawName.indexOf('::');
|
||||
if (separator <= 0) return undefined;
|
||||
const head = ref.rawName.slice(0, separator).trim();
|
||||
if (
|
||||
isCppNamespaceQualifierShadowed(
|
||||
head,
|
||||
ref.declaredAtScope,
|
||||
indexes,
|
||||
ref.lookupPosition ?? ref.bindingRange,
|
||||
)
|
||||
) {
|
||||
// A concrete class can still own the written nested type. A type alias or
|
||||
// dependent qualifier with no class identity cannot borrow a namespace.
|
||||
return findClassBindingInScope(ref.declaredAtScope, head, indexes, undefined, {
|
||||
uniqueQualifiedNameFallback: false,
|
||||
position: ref.lookupPosition ?? ref.bindingRange,
|
||||
purpose: 'type',
|
||||
}) === undefined
|
||||
? null
|
||||
: undefined;
|
||||
}
|
||||
const alias = visibleNamespaceAlias(
|
||||
head,
|
||||
ref.declaredAtScope,
|
||||
indexes,
|
||||
ref.lookupPosition ?? ref.bindingRange,
|
||||
);
|
||||
const expanded =
|
||||
alias === undefined ? undefined : `${alias}::${ref.rawName.slice(separator + 2)}`;
|
||||
const spelling = expanded ?? ref.rawName;
|
||||
const last = spelling.lastIndexOf('::');
|
||||
const qualifier = spelling.slice(0, last).replace(/::/g, '.');
|
||||
const tail = spelling.slice(last + 2);
|
||||
const qualifiers = new Set([qualifier]);
|
||||
if (alias === undefined && !spelling.startsWith('::')) {
|
||||
const enclosing: string[] = [];
|
||||
let scope = indexes.scopeTree.getScope(ref.declaredAtScope);
|
||||
const seen = new Set<ScopeId>();
|
||||
while (scope !== undefined && !seen.has(scope.id)) {
|
||||
seen.add(scope.id);
|
||||
if (scope.kind === 'Namespace') {
|
||||
const name = scope.ownedDefs.find((def) => def.type === 'Namespace')?.qualifiedName;
|
||||
if (name !== undefined) enclosing.unshift(name.slice(name.lastIndexOf('.') + 1));
|
||||
}
|
||||
scope = scope.parent === null ? undefined : indexes.scopeTree.getScope(scope.parent);
|
||||
}
|
||||
for (let length = enclosing.length; length > 0; length--)
|
||||
qualifiers.add([...enclosing.slice(0, length), qualifier].join('.'));
|
||||
}
|
||||
const matches = new Map<string, string>();
|
||||
for (const candidateId of indexes.qualifiedNames.get(tail)) {
|
||||
const classScopeId = classScopeIds.get(indexes)?.get(candidateId);
|
||||
if (classScopeId === undefined) continue;
|
||||
let parent = indexes.scopeTree.getScope(classScopeId)?.parent ?? null;
|
||||
const visited = new Set<ScopeId>();
|
||||
const full: string[] = [];
|
||||
const transparent: string[] = [];
|
||||
let hasInline = false;
|
||||
while (parent !== null && !visited.has(parent)) {
|
||||
visited.add(parent);
|
||||
const scope = indexes.scopeTree.getScope(parent);
|
||||
if (scope === undefined) break;
|
||||
if (scope.kind === 'Namespace') {
|
||||
const name = scope.ownedDefs.find((def) => def.type === 'Namespace')?.qualifiedName;
|
||||
if (name !== undefined) {
|
||||
const segment = name.slice(name.lastIndexOf('.') + 1);
|
||||
full.unshift(segment);
|
||||
if (isCppInlineNamespaceScope(scope.id)) hasInline = true;
|
||||
else transparent.unshift(segment);
|
||||
}
|
||||
}
|
||||
parent = scope.parent;
|
||||
}
|
||||
if (hasInline && qualifiers.has(transparent.join('.')))
|
||||
matches.set(candidateId, [...full, tail].join('::'));
|
||||
}
|
||||
return matches.size === 1 ? matches.values().next().value : expanded;
|
||||
}
|
||||
|
||||
/** Materialize namespace identities once, then augment only the using's owner. */
|
||||
export function populateCppUsingBindings(
|
||||
parsedFiles: readonly ParsedFile[],
|
||||
indexes: ScopeResolutionIndexes,
|
||||
): void {
|
||||
const classes = new Map<string, ScopeId>();
|
||||
for (const parsed of parsedFiles) {
|
||||
for (const scope of parsed.scopes) {
|
||||
if (scope.kind !== 'Class') continue;
|
||||
const definition = scope.ownedDefs.find((def) => isClassLike(def.type));
|
||||
if (definition !== undefined) classes.set(definition.nodeId, scope.id);
|
||||
}
|
||||
}
|
||||
classScopeIds.set(indexes, classes);
|
||||
if (!parsedFiles.some((parsed) => usingDeclarations(parsed).length > 0)) return;
|
||||
const namespaceLookup = createNamespaceLookup(parsedFiles, (id) =>
|
||||
indexes.scopeTree.getScope(id),
|
||||
);
|
||||
const { namespacePath } = namespaceLookup;
|
||||
const aliases = new Map<ScopeId, Map<string, NamespaceAliasTarget>>();
|
||||
namespaceAliases.set(indexes, aliases);
|
||||
const installAlias = (scope: ScopeId, name: string, value: NamespaceAliasTarget): void => {
|
||||
let bucket = aliases.get(scope);
|
||||
if (bucket === undefined) {
|
||||
bucket = new Map();
|
||||
aliases.set(scope, bucket);
|
||||
}
|
||||
bucket.set(name, value);
|
||||
};
|
||||
const byFile = new Map(parsedFiles.map((parsed) => [parsed.filePath, parsed]));
|
||||
const visibleFiles = createIncludeClosure((filePath) => {
|
||||
const parsed = byFile.get(filePath);
|
||||
|
|
@ -389,6 +549,38 @@ export function populateCppUsingBindings(
|
|||
edge.targetFile !== null && edge.linkStatus !== 'unresolved' ? [edge.targetFile] : [],
|
||||
);
|
||||
});
|
||||
const consumersByHeader = new Map<
|
||||
string,
|
||||
Map<ScopeId, Pick<Range, 'startLine' | 'startCol'> | undefined>
|
||||
>();
|
||||
const aliasFiles = new Set(
|
||||
parsedFiles
|
||||
.filter((parsed) =>
|
||||
usingDeclarations(parsed).some((declaration) => declaration.alias !== undefined),
|
||||
)
|
||||
.map((parsed) => parsed.filePath),
|
||||
);
|
||||
if (aliasFiles.size > 0) {
|
||||
for (const consumer of parsedFiles) {
|
||||
for (const edge of indexes.imports.get(consumer.moduleScope) ?? []) {
|
||||
if (edge.targetFile === null || edge.linkStatus === 'unresolved') continue;
|
||||
for (const header of visibleFiles(edge.targetFile)) {
|
||||
if (header === consumer.filePath || !aliasFiles.has(header)) continue;
|
||||
const consumers = consumersByHeader.get(header) ?? new Map();
|
||||
const previous = consumers.get(consumer.moduleScope);
|
||||
const availableFrom = edge.atRange === undefined ? undefined : end(edge.atRange);
|
||||
if (
|
||||
!consumers.has(consumer.moduleScope) ||
|
||||
availableFrom === undefined ||
|
||||
(previous !== undefined && compare(availableFrom, previous) < 0)
|
||||
) {
|
||||
consumers.set(consumer.moduleScope, availableFrom);
|
||||
}
|
||||
consumersByHeader.set(header, consumers);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const augmentations = indexes.bindingAugmentations as Map<ScopeId, Map<string, BindingRef[]>>;
|
||||
const append = (
|
||||
scope: Scope,
|
||||
|
|
@ -412,22 +604,72 @@ export function populateCppUsingBindings(
|
|||
}
|
||||
bindings.set(name, bucket);
|
||||
};
|
||||
const resolveDeclaration = (parsed: ParsedFile, declaration: CppUsingDeclaration) => {
|
||||
const owner = owningScope(parsed, declaration.range);
|
||||
if (owner === undefined) return undefined;
|
||||
const parts = declaration.namespace.split('::').map((part) => part.trim());
|
||||
const head = parts[0];
|
||||
const alias =
|
||||
head === undefined || head.length === 0
|
||||
? undefined
|
||||
: visibleNamespaceAlias(head, owner.id, indexes, declaration.range);
|
||||
const resolved = resolveUsingMembers(
|
||||
alias === undefined
|
||||
? declaration
|
||||
: { ...declaration, namespace: `::${[alias, ...parts.slice(1)].join('::')}` },
|
||||
owner,
|
||||
parsed.filePath,
|
||||
visibleFiles(parsed.filePath),
|
||||
namespaceLookup,
|
||||
);
|
||||
return resolved === undefined ? undefined : { owner, ...resolved };
|
||||
};
|
||||
// Includes are leaves-first. Retry only unresolved aliases inside cycles;
|
||||
// successful aliases have canonical targets and never need expanding again.
|
||||
const ordered = new Map<string, ParsedFile>();
|
||||
for (const scc of indexes.sccs)
|
||||
for (const file of scc.files) {
|
||||
const parsed = byFile.get(file);
|
||||
if (parsed !== undefined) ordered.set(file, parsed);
|
||||
}
|
||||
for (const parsed of parsedFiles)
|
||||
if (!ordered.has(parsed.filePath)) ordered.set(parsed.filePath, parsed);
|
||||
let pending = [...ordered.values()].flatMap((parsed) =>
|
||||
usingDeclarations(parsed)
|
||||
.filter((declaration) => declaration.alias !== undefined)
|
||||
.map((declaration) => ({ parsed, declaration })),
|
||||
);
|
||||
while (pending.length > 0) {
|
||||
const retry: typeof pending = [];
|
||||
for (const item of pending) {
|
||||
const resolved = resolveDeclaration(item.parsed, item.declaration);
|
||||
const name = item.declaration.alias;
|
||||
if (resolved === undefined || name === undefined) {
|
||||
retry.push(item);
|
||||
continue;
|
||||
}
|
||||
installAlias(resolved.owner.id, name, {
|
||||
target: resolved.target,
|
||||
availableFrom: item.declaration.range,
|
||||
});
|
||||
if (resolved.owner.id === item.parsed.moduleScope)
|
||||
for (const [consumer, availableFrom] of consumersByHeader.get(item.parsed.filePath) ?? [])
|
||||
installAlias(consumer, name, {
|
||||
target: resolved.target,
|
||||
availableFrom,
|
||||
});
|
||||
}
|
||||
if (retry.length === pending.length) break;
|
||||
pending = retry;
|
||||
}
|
||||
for (const parsed of parsedFiles) {
|
||||
const facts = usingDeclarations(parsed);
|
||||
if (facts.length === 0) continue;
|
||||
const visible = visibleFiles(parsed.filePath);
|
||||
for (const declaration of facts) {
|
||||
const owner = owningScope(parsed, declaration.range);
|
||||
if (owner === undefined) continue;
|
||||
const resolved = resolveUsingMembers(
|
||||
declaration,
|
||||
owner,
|
||||
parsed.filePath,
|
||||
visible,
|
||||
namespaceLookup,
|
||||
);
|
||||
if (declaration.alias !== undefined) continue;
|
||||
const resolved = resolveDeclaration(parsed, declaration);
|
||||
if (resolved === undefined) continue;
|
||||
const { target, members } = resolved;
|
||||
const { owner, target, members } = resolved;
|
||||
for (const [name, refs] of members) {
|
||||
if (declaration.name !== undefined) {
|
||||
append(owner, name, refs, declaration);
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ import { csharpClassConfig } from '../class-extractors/configs/csharp.js';
|
|||
import { defineLanguage } from '../language-provider.js';
|
||||
import { typeConfig as csharpConfig } from '../type-extractors/csharp.js';
|
||||
import { csharpExportChecker } from '../export-detection.js';
|
||||
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
||||
import { csharpImportConfig } from '../import-resolvers/configs/csharp.js';
|
||||
import { CSHARP_QUERIES } from '../tree-sitter-queries.js';
|
||||
import { createLeadingDocDescriptionExtractor } from '../utils/ast-helpers.js';
|
||||
import type { AstFrameworkPatternConfig } from '../language-provider.js';
|
||||
|
|
@ -195,7 +193,6 @@ export const csharpProvider = defineLanguage({
|
|||
`,
|
||||
typeConfig: csharpConfig,
|
||||
exportChecker: csharpExportChecker,
|
||||
importResolver: createImportResolver(csharpImportConfig),
|
||||
mroStrategy: 'implements-split',
|
||||
callExtractor: createCallExtractor(csharpCallConfig),
|
||||
fieldExtractor: createFieldExtractor(csharpFieldConfig),
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
/**
|
||||
* C# namespace import resolution — internal helpers.
|
||||
*
|
||||
* Strategy lives in configs/csharp.ts.
|
||||
* Used by the C# ScopeResolver.resolveImportTarget hook.
|
||||
* This file contains shared helpers for namespace-based resolution.
|
||||
*/
|
||||
|
||||
import { perFileSet } from './per-file-set.js';
|
||||
import { getWorkspaceFileIndex } from './workspace-file-index.js';
|
||||
import type { SuffixIndex } from './utils.js';
|
||||
import { suffixResolve } from './utils.js';
|
||||
import type { CSharpProjectConfig, CSharpNamespaceEvidence } from '../language-config.js';
|
||||
import { csharpSuffixFallbackAllowed } from '../csharp-namespace-gate.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
import { getWorkspaceFileIndex } from '../../utils/workspace-file-index.js';
|
||||
import type { SuffixIndex } from '../../utils/suffix-index.js';
|
||||
import { suffixResolve } from '../../utils/suffix-index.js';
|
||||
import type { CSharpProjectConfig, CSharpNamespaceEvidence } from '../../language-config.js';
|
||||
import { csharpSuffixFallbackAllowed } from './namespace-gate.js';
|
||||
import { EXTENSIONS } from '../import-candidates.js';
|
||||
|
||||
/**
|
||||
* Directory index backing the namespace-directory fallback below (step 3).
|
||||
|
|
@ -397,40 +398,6 @@ export function resolveCSharpImportInternal(
|
|||
return [];
|
||||
}
|
||||
const pathParts = namespacePath.split('/').filter(Boolean);
|
||||
const fallback = suffixResolve(pathParts, normalizedFileList, allFileList, index);
|
||||
const fallback = suffixResolve(pathParts, normalizedFileList, allFileList, EXTENSIONS, index);
|
||||
return fallback ? [fallback] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the directory suffix for a C# namespace import (for PackageMap).
|
||||
* Returns a suffix like "/ProjectDir/Models/" or null if no config matches.
|
||||
*/
|
||||
export function resolveCSharpNamespaceDir(
|
||||
importPath: string,
|
||||
csharpConfigs: CSharpProjectConfig[],
|
||||
): string | null {
|
||||
const namespacePath = importPath.replace(/\./g, '/');
|
||||
|
||||
for (const config of csharpConfigs) {
|
||||
const nsPath = config.rootNamespace.replace(/\./g, '/');
|
||||
let relative: string;
|
||||
if (namespacePath.startsWith(nsPath + '/')) {
|
||||
relative = namespacePath.slice(nsPath.length + 1);
|
||||
} else if (namespacePath === nsPath) {
|
||||
relative = '';
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
const dirPrefix = config.projectDir
|
||||
? relative
|
||||
? config.projectDir + '/' + relative
|
||||
: config.projectDir
|
||||
: relative;
|
||||
|
||||
if (!dirPrefix) continue;
|
||||
return '/' + dirPrefix + '/';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -21,18 +21,18 @@
|
|||
|
||||
import type { ParsedImport, WorkspaceIndex } from 'gitnexus-shared';
|
||||
import type { CSharpProjectConfig, CSharpNamespaceEvidence } from '../../language-config.js';
|
||||
import { resolveCSharpImportInternal } from '../../import-resolvers/csharp.js';
|
||||
import { resolveCSharpImportInternal } from './import-helpers.js';
|
||||
import {
|
||||
getWorkspaceFileIndex,
|
||||
type WorkspaceFileIndex,
|
||||
} from '../../import-resolvers/workspace-file-index.js';
|
||||
} from '../../utils/workspace-file-index.js';
|
||||
import {
|
||||
buildPackageDirIndex,
|
||||
firstFileDirectlyInPkgDir,
|
||||
type PackageDirIndex,
|
||||
} from '../../import-resolvers/package-dir-index.js';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import { csharpSuffixFallbackAllowed } from '../../csharp-namespace-gate.js';
|
||||
} from '../../utils/package-dir-index.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
import { csharpSuffixFallbackAllowed } from './namespace-gate.js';
|
||||
|
||||
export interface CsharpResolveContext {
|
||||
readonly fromFile: string;
|
||||
|
|
@ -44,7 +44,7 @@ export interface CsharpResolveContext {
|
|||
/**
|
||||
* Namespace-directory index over the `.cs` files, memoized on the Set's
|
||||
* identity. Feeds `firstFileDirectlyInPkgDir` (in
|
||||
* `import-resolvers/package-dir-index.ts`), which the no-csproj path calls once
|
||||
* `utils/package-dir-index.ts`), which the no-csproj path calls once
|
||||
* for the direct match and then up to once per stripped namespace prefix.
|
||||
*/
|
||||
const getCsharpDirIndex = perFileSet(
|
||||
|
|
@ -74,8 +74,7 @@ export function resolveCsharpImportTarget(
|
|||
evidence,
|
||||
);
|
||||
if (fromCsproj.length > 0) return fromCsproj[0]!;
|
||||
// csproj configs are authoritative: mirror legacy `configs/csharp.ts`,
|
||||
// which returns an empty result to STOP the chain. Falling through to the
|
||||
// csproj configs are authoritative. Falling through to the
|
||||
// ungated `resolveDirectMatch` would re-introduce the BCL→local match the
|
||||
// internal resolver's gate just suppressed (#1881 parity, #2).
|
||||
return null;
|
||||
|
|
@ -87,10 +86,8 @@ export function resolveCsharpImportTarget(
|
|||
// Gate the WHOLE no-csproj path on declared in-repo namespaces — the direct
|
||||
// path/suffix match INCLUDED — so a BCL using can't resolve to a
|
||||
// coincidentally path-aligned local file (e.g. `Legacy/System/Threading/
|
||||
// Tasks.cs` satisfying `using System.Threading.Tasks;`). Running the gate
|
||||
// before `resolveDirectMatch` mirrors the legacy leg's gate-first ordering
|
||||
// (`import-resolvers/configs/csharp.ts`), so the two legs are equivalent
|
||||
// (#1881 parity, Codex F2). The gate keeps its fail-open for
|
||||
// Tasks.cs` satisfying `using System.Threading.Tasks;`). The gate runs
|
||||
// before `resolveDirectMatch` and keeps its fail-open for
|
||||
// undefined/truncated evidence, so legitimate edges in unscanned repos are
|
||||
// unaffected.
|
||||
if (!csharpSuffixFallbackAllowed(targetRaw, evidence)) {
|
||||
|
|
|
|||
|
|
@ -3,13 +3,11 @@
|
|||
* (e.g. `System.Threading.Tasks`) can't match a coincidentally-named local
|
||||
* file (#1881).
|
||||
*
|
||||
* Lives in the shared `ingestion/` layer — NOT under `languages/csharp/` — so
|
||||
* BOTH the registry-primary scope resolver (`languages/csharp/import-target.ts`)
|
||||
* and the legacy DAG resolver (`import-resolvers/csharp.ts`) can import it
|
||||
* without an `import-resolvers/ -> languages/` dependency inversion (#5).
|
||||
* Shared by this provider's import-target adapter and namespace-directory
|
||||
* helpers. The legacy DAG resolver has been removed.
|
||||
*/
|
||||
|
||||
import type { CSharpNamespaceEvidence } from './language-config.js';
|
||||
import type { CSharpNamespaceEvidence } from '../../language-config.js';
|
||||
|
||||
/**
|
||||
* Top-level namespace segments that clearly belong to the BCL / runtime / a
|
||||
|
|
@ -26,8 +26,9 @@
|
|||
* / `Scope.typeBindings`. That per-file copy was O(files²) for a
|
||||
* concentrated namespace and OOM'd large solutions (#1871; the global
|
||||
* twin was fixed in #1905/#1954). The walkers consult these channels
|
||||
* gated by `accessibleNamespacesByScope` (a file's own namespace +
|
||||
* `using` targets), so visibility is unchanged — only the storage is
|
||||
* gated by `accessibleNamespacesByScope` (a file's own and enclosing
|
||||
* namespaces, the global namespace, and `using` targets, in C# lookup
|
||||
* order), so visibility is unchanged — only the storage is
|
||||
* shared. Finalized bindings remain first in `lookupBindingsAt`, and
|
||||
* local lexical `Scope.bindings` remains the first-tier shadowing
|
||||
* channel. (`using static` member exposure still uses the per-scope
|
||||
|
|
@ -478,9 +479,9 @@ export function populateCsharpNamespaceSiblings(
|
|||
// both time and memory and OOM'd large no-namespace solutions (tens of
|
||||
// thousands of files in the global bucket → billions of Map entries). This
|
||||
// mirrors how Roslyn resolves against a single `Compilation.GlobalNamespace`
|
||||
// symbol instead of per-file copies, and is the typeBindings analogue of the
|
||||
// `workspaceFqnBindings` fast-path (#1905). `findReceiverTypeBinding` /
|
||||
// `followChainPostFinalize` consult this channel as a final fallback.
|
||||
// symbol instead of per-file copies (#1905). `findReceiverTypeBinding` /
|
||||
// `followChainPostFinalize` consult this channel as a final fallback. Global
|
||||
// class bindings go through the per-namespace channel instead (see below).
|
||||
const workspaceTypeBindings = indexes.workspaceTypeBindings as Map<string, TypeRef>;
|
||||
const globalBucket = buckets.get('');
|
||||
if (globalBucket !== undefined) {
|
||||
|
|
@ -523,38 +524,94 @@ export function populateCsharpNamespaceSiblings(
|
|||
}
|
||||
}
|
||||
|
||||
// Materialize each file's accessible namespaces (its own declared namespaces +
|
||||
// every `using namespace X;` target, plus dotted-path prefixes), keyed by the
|
||||
// file's Module scope id. This is the SAME accessibility set the per-file copy
|
||||
// above used to derive — now stored so the language-neutral walkers can gate
|
||||
// their `namespaceFqnBindings` / `namespaceTypeBindings` lookups to exactly the
|
||||
// namespaces a file can see. The global ('') namespace is excluded: it is
|
||||
// type-visible everywhere and handled by the flat workspace channels.
|
||||
// Namespace lookup follows declaration scopes. Types from one precedence
|
||||
// group compete together; a nearer group hides later groups.
|
||||
const accessibleNamespacesByScope = indexes.accessibleNamespacesByScope as Map<ScopeId, string[]>;
|
||||
const namespaceTiers = indexes.namespaceLookupTiersByScope as
|
||||
| Map<ScopeId, readonly (readonly string[])[]>
|
||||
| undefined;
|
||||
for (const parsed of parsedFiles) {
|
||||
const moduleScope = parsed.scopes.find((s) => s.kind === 'Module');
|
||||
const moduleScope = parsed.scopes.find((scope) => scope.kind === 'Module');
|
||||
if (moduleScope === undefined) continue;
|
||||
const accessibleNamespaces = new Set<string>();
|
||||
const struct = structureByFile.get(parsed.filePath);
|
||||
if (struct !== undefined) {
|
||||
for (const n of struct.namespaces) accessibleNamespaces.add(n);
|
||||
const declared = structureByFile.get(parsed.filePath)?.namespaces ?? [];
|
||||
const usings = usingTargetsByDeclaration(parsed, declared);
|
||||
const namespaceScopes = parsed.scopes
|
||||
.filter((scope) => scope.kind === 'Namespace')
|
||||
.sort((a, b) => comparePositions(a.range.startLine, a.range.startCol, b.range));
|
||||
const namesByScope = new Map<ScopeId, string>();
|
||||
for (let i = 0; i < namespaceScopes.length; i++) {
|
||||
const scope = namespaceScopes[i]!;
|
||||
const name = declaredNameAt(declared, namespaceScopes.length, i);
|
||||
const parentName = scope.parent === null ? undefined : namesByScope.get(scope.parent);
|
||||
if (name !== undefined)
|
||||
namesByScope.set(scope.id, parentName === undefined ? name : `${parentName}.${name}`);
|
||||
}
|
||||
for (const imp of parsed.parsedImports) {
|
||||
if (imp.kind === 'namespace' && imp.targetRaw !== null) {
|
||||
accessibleNamespaces.add(imp.targetRaw);
|
||||
const scopesById = new Map(namespaceScopes.map((scope) => [scope.id, scope]));
|
||||
const sourceLines = (inputs.fileContents.get(parsed.filePath) ?? '').split('\n');
|
||||
const fileScoped = namespaceScopes.find((scope) => {
|
||||
let inComment = false;
|
||||
for (let line = scope.range.startLine - 1; line < scope.range.endLine; line++) {
|
||||
const text = sourceLines[line] ?? '';
|
||||
const start = line === scope.range.startLine - 1 ? scope.range.startCol : 0;
|
||||
for (let column = start; column < text.length; column++) {
|
||||
if (inComment) {
|
||||
if (text[column] === '*' && text[column + 1] === '/') {
|
||||
inComment = false;
|
||||
column++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (text[column] === '/' && text[column + 1] === '/') break;
|
||||
if (text[column] === '/' && text[column + 1] === '*') {
|
||||
inComment = true;
|
||||
column++;
|
||||
continue;
|
||||
}
|
||||
if (text[column] === '{') return false;
|
||||
if (text[column] === ';') return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
const expandedNamespaces = new Set<string>(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('.'));
|
||||
return false;
|
||||
});
|
||||
const install = (scopeId: ScopeId, owner?: Scope): void => {
|
||||
const tiers: string[][] = [];
|
||||
const seen = new Set<string>();
|
||||
const imported: string[] = [];
|
||||
const addNamespace = (name: string): void => {
|
||||
if (!seen.has(name)) {
|
||||
seen.add(name);
|
||||
tiers.push([name]);
|
||||
}
|
||||
};
|
||||
const visited = new Set<ScopeId>();
|
||||
let current = owner;
|
||||
while (current !== undefined && !visited.has(current.id)) {
|
||||
visited.add(current.id);
|
||||
const name = namesByScope.get(current.id);
|
||||
if (name !== undefined) {
|
||||
addNamespace(name);
|
||||
const targets = usings.byDeclaration.get(current.id) ?? [];
|
||||
if (targets.length > 0) {
|
||||
tiers.push([...targets]);
|
||||
imported.push(...targets);
|
||||
}
|
||||
for (const enclosing of enclosingNamespaces(name)) addNamespace(enclosing);
|
||||
}
|
||||
current = current.parent === null ? undefined : scopesById.get(current.parent);
|
||||
}
|
||||
}
|
||||
expandedNamespaces.delete(''); // global handled by the flat workspace channels
|
||||
if (expandedNamespaces.size > 0) {
|
||||
accessibleNamespacesByScope.set(moduleScope.id, [...expandedNamespaces]);
|
||||
}
|
||||
addNamespace('');
|
||||
if (usings.compilationUnit.length > 0) {
|
||||
tiers.push([...usings.compilationUnit]);
|
||||
imported.push(...usings.compilationUnit);
|
||||
}
|
||||
for (const target of imported) {
|
||||
for (const prefix of enclosingNamespaces(target)) addNamespace(prefix);
|
||||
}
|
||||
accessibleNamespacesByScope.set(scopeId, [...new Set(tiers.flat())]);
|
||||
namespaceTiers?.set(scopeId, tiers);
|
||||
};
|
||||
install(moduleScope.id, fileScoped);
|
||||
for (const scope of namespaceScopes) install(scope.id, scope);
|
||||
}
|
||||
|
||||
// `using static X.Y.Z;` — expose every public static method of
|
||||
|
|
@ -633,20 +690,14 @@ export function populateCsharpNamespaceSiblings(
|
|||
// augmentation removes an O(importers × bucket-size) fanout on popular
|
||||
// namespaces — the cross-namespace twin of the same-namespace blow-up.
|
||||
|
||||
// Workspace-level binding channel for global-namespace types (see the
|
||||
// global fast-path below). `lookupBindingsAt` consults this as a third
|
||||
// source after finalized + per-scope augmented bindings. Its inner arrays
|
||||
// are mutable by contract (append-only, like `bindingAugmentations` — see
|
||||
// the ScopeResolutionIndexes doc + validateBindingsImmutability), so the
|
||||
// ReadonlyMap→Map cast is localized to this one line and all writes go
|
||||
// through `getWorkspaceBucket`.
|
||||
const workspace = indexes.workspaceFqnBindings as Map<string, BindingRef[]>;
|
||||
// Per-namespace binding channel for NAMED-namespace class visibility — the
|
||||
// namespace-scoped analogue of `workspace`, populated once per named bucket
|
||||
// (#1871). Replaces the per-scope `bindingAugmentations` fanout (O(scopes ×
|
||||
// defs)) for same-namespace siblings AND the per-file cross-namespace-`using`
|
||||
// injection above. `lookupBindingsAt` consults it gated by
|
||||
// `accessibleNamespacesByScope`.
|
||||
// Per-namespace binding channel for class visibility, populated once per
|
||||
// bucket (#1871), the global ('') bucket included. Replaces the per-scope
|
||||
// `bindingAugmentations` fanout (O(scopes × defs)) for same-namespace
|
||||
// siblings AND the per-file cross-namespace-`using` injection above.
|
||||
// `lookupBindingsAt` consults it gated by `accessibleNamespacesByScope`.
|
||||
// Its inner arrays are mutable by contract (append-only, like
|
||||
// `bindingAugmentations`; see the ScopeResolutionIndexes doc and
|
||||
// validateBindingsImmutability).
|
||||
const namespaceFqn = indexes.namespaceFqnBindings as Map<string, Map<string, BindingRef[]>>;
|
||||
|
||||
for (const [nsName, bucket] of buckets) {
|
||||
|
|
@ -670,42 +721,20 @@ export function populateCsharpNamespaceSiblings(
|
|||
arr.push(def);
|
||||
}
|
||||
|
||||
// Global-namespace fast path (Unity OOM guard). Types declared in the
|
||||
// default (global) namespace are visible from EVERY file in C# — the
|
||||
// global namespace is always implicitly in scope — so one workspace-
|
||||
// level entry per simple name is both semantically correct and O(D)
|
||||
// instead of the O(S·D) per-scope augmentation that materialized
|
||||
// billions of BindingRefs on large Unity solutions (tens of thousands
|
||||
// of global types × tens of thousands of scopes). `walkScopeChain`
|
||||
// checks local `scope.bindings` first, so local declarations still
|
||||
// shadow these workspace entries; a file resolving its own global type
|
||||
// hits the local binding before this map. Dedup by `def.nodeId` keeps
|
||||
// partial-class / duplicate declarations from double-emitting.
|
||||
if (nsName === '') {
|
||||
for (const [name, defs] of defsByName) {
|
||||
const bucket = getWorkspaceBucket(workspace, name);
|
||||
const seen = new Set<string>();
|
||||
for (const b of bucket) seen.add(b.def.nodeId);
|
||||
for (const def of defs) {
|
||||
if (seen.has(def.nodeId)) continue; // dedup by nodeId (keeps partials, drops re-emits)
|
||||
seen.add(def.nodeId);
|
||||
bucket.push({ def, origin: 'namespace' });
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Named-namespace fast path (#1871) — the namespace-scoped mirror of the
|
||||
// global path above. One `namespaceFqnBindings[nsName]` entry per simple
|
||||
// name, O(D) per bucket, instead of the prior O(scopes × defs) per-scope
|
||||
// augmentation that materialized O(files²) BindingRefs for a concentrated
|
||||
// named namespace. `lookupBindingsAt` consults this gated by
|
||||
// `accessibleNamespacesByScope` and ranks finalized `scope.bindings`
|
||||
// (local declarations) ABOVE it, so local types still shadow — exactly as
|
||||
// `walkScopeChain` shadows the global workspace entries. Dedup by
|
||||
// One `namespaceFqnBindings[nsName]` entry per simple name, O(D) per
|
||||
// bucket, instead of the prior O(scopes × defs) per-scope augmentation
|
||||
// that materialized O(files²) BindingRefs for a concentrated namespace
|
||||
// (#1871), and billions for the global bucket of a large Unity solution
|
||||
// (tens of thousands of global types × tens of thousands of scopes).
|
||||
// Global types share this channel rather than a scope-independent one:
|
||||
// the walkers consult it at the provider's owning scopes through their
|
||||
// ordered accessibility list, so a global type no longer answers from a
|
||||
// method scope before the walk reaches the file's own namespace.
|
||||
// `lookupBindingsAt` ranks finalized `scope.bindings` (local declarations)
|
||||
// ABOVE this channel, so local types still shadow it. Dedup by
|
||||
// `def.nodeId` keeps partial-class / duplicate declarations from
|
||||
// double-emitting. (The prior local-shadow and self-reference skips are now
|
||||
// handled by lookup precedence, identical to the global path.)
|
||||
// double-emitting. (The prior local-shadow and self-reference skips are
|
||||
// handled by lookup precedence.)
|
||||
let nsMap = namespaceFqn.get(nsName);
|
||||
for (const [name, defs] of defsByName) {
|
||||
let bucketArr = nsMap?.get(name);
|
||||
|
|
@ -755,20 +784,89 @@ function getAugmentationBucket(
|
|||
return bucketArr;
|
||||
}
|
||||
|
||||
/** Get-or-create a mutable inner bucket inside the `workspaceFqnBindings`
|
||||
* channel (the scope-independent third channel; see
|
||||
* `ScopeResolutionIndexes.workspaceFqnBindings`). Like
|
||||
* `getAugmentationBucket`, the inner arrays are mutable by contract —
|
||||
* callers `push` directly. Keeping the get-or-create here means the one
|
||||
* ReadonlyMap→Map cast at the call site is the only place the mutable
|
||||
* view is taken. */
|
||||
function getWorkspaceBucket(workspace: Map<string, BindingRef[]>, name: string): BindingRef[] {
|
||||
let bucketArr = workspace.get(name);
|
||||
if (bucketArr === undefined) {
|
||||
bucketArr = [];
|
||||
workspace.set(name, bucketArr);
|
||||
/** `using` targets of one file, grouped by the declaration that owns them. */
|
||||
interface UsingTargetsByDeclaration {
|
||||
readonly byDeclaration: ReadonlyMap<ScopeId, readonly string[]>;
|
||||
/** Directives at compilation-unit level. */
|
||||
readonly compilationUnit: readonly string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Group a file's `using` targets by the declaration that owns them, which is
|
||||
* the level C# name lookup consults them at.
|
||||
*
|
||||
* A directive belongs to the last namespace declaration that starts before it.
|
||||
* For a block namespace, that declaration contains it. A file-scoped
|
||||
* `namespace X;` scope covers only its own line, and the directives after it
|
||||
* still belong to `X`. Directives cannot follow a closed block namespace
|
||||
* (CS1529), so the rule needs no other case. Namespace scopes pair with
|
||||
* `declared` by source order. When the counts disagree, as with an incomplete
|
||||
* line scan, every namespace-level directive goes to the first declared
|
||||
* namespace, matching how top-level classes are attributed above.
|
||||
*/
|
||||
function usingTargetsByDeclaration(
|
||||
parsed: ParsedFile,
|
||||
declared: readonly string[],
|
||||
): UsingTargetsByDeclaration {
|
||||
const namespaceScopes = parsed.scopes
|
||||
.filter((s) => s.kind === 'Namespace')
|
||||
.sort((a, b) => comparePositions(a.range.startLine, a.range.startCol, b.range));
|
||||
const byDeclaration = new Map<ScopeId, string[]>();
|
||||
const compilationUnit: string[] = [];
|
||||
for (const imp of parsed.parsedImports) {
|
||||
if (imp.kind !== 'namespace' || imp.targetRaw === null) continue;
|
||||
const at = imp.atRange;
|
||||
let owner = -1;
|
||||
if (at !== undefined) {
|
||||
let lo = 0;
|
||||
let hi = namespaceScopes.length;
|
||||
while (lo < hi) {
|
||||
const mid = Math.floor((lo + hi) / 2);
|
||||
if (comparePositions(at.startLine, at.startCol, namespaceScopes[mid]!.range) > 0) {
|
||||
lo = mid + 1;
|
||||
} else {
|
||||
hi = mid;
|
||||
}
|
||||
}
|
||||
owner = lo - 1;
|
||||
}
|
||||
const name = owner === -1 ? undefined : declaredNameAt(declared, namespaceScopes.length, owner);
|
||||
if (name === undefined) {
|
||||
compilationUnit.push(imp.targetRaw);
|
||||
continue;
|
||||
}
|
||||
const ownerScope = namespaceScopes[owner];
|
||||
if (ownerScope !== undefined) {
|
||||
const ownTargets = byDeclaration.get(ownerScope.id) ?? [];
|
||||
ownTargets.push(imp.targetRaw);
|
||||
byDeclaration.set(ownerScope.id, ownTargets);
|
||||
}
|
||||
}
|
||||
return bucketArr;
|
||||
return { byDeclaration, compilationUnit };
|
||||
}
|
||||
|
||||
/** The declared namespace name for the `index`-th Namespace scope, or the first
|
||||
* declared name when scopes and declarations do not pair one-to-one. */
|
||||
function declaredNameAt(
|
||||
declared: readonly string[],
|
||||
scopeCount: number,
|
||||
index: number,
|
||||
): string | undefined {
|
||||
return declared.length === scopeCount ? declared[index] : declared[0];
|
||||
}
|
||||
|
||||
/** Sign of position (`line`, `col`) relative to the start of `range`. */
|
||||
function comparePositions(line: number, col: number, range: Scope['range']): number {
|
||||
return line !== range.startLine ? line - range.startLine : col - range.startCol;
|
||||
}
|
||||
|
||||
/** The namespaces enclosing a dotted namespace name, innermost first:
|
||||
* `A.B.C` → `A.B`, `A`. The global namespace is not included. */
|
||||
function enclosingNamespaces(ns: string): string[] {
|
||||
const segments = ns.split('.');
|
||||
const out: string[] = [];
|
||||
for (let i = segments.length - 1; i > 0; i--) out.push(segments.slice(0, i).join('.'));
|
||||
return out;
|
||||
}
|
||||
|
||||
function isTypeDef(def: SymbolDefinition): boolean {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Loaded once per analyze pass via `csharpScopeResolver.loadResolutionConfig`
|
||||
* and threaded into `resolveCsharpImportTarget`. The pure gate predicates live
|
||||
* in `../../csharp-namespace-gate.ts` (shared with the legacy DAG resolver).
|
||||
* in `./namespace-gate.ts`.
|
||||
*/
|
||||
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,13 @@
|
|||
* canonical shape.
|
||||
*/
|
||||
|
||||
import type { ParsedFile } from 'gitnexus-shared';
|
||||
import type { ParsedFile, ScopeId } from 'gitnexus-shared';
|
||||
import { CLASS_KINDS, SupportedLanguages } from 'gitnexus-shared';
|
||||
import { buildMro, defaultLinearize } from '../../scope-resolution/passes/mro.js';
|
||||
import { populateClassOwnedMembers } from '../../scope-resolution/scope/walkers.js';
|
||||
import {
|
||||
populateClassOwnedMembers,
|
||||
lookupNameClaim,
|
||||
} from '../../scope-resolution/scope/walkers.js';
|
||||
import { populateCsharpNamespacePrefixes } from './qualified-type-names.js';
|
||||
import type { ScopeResolver } from '../../scope-resolution/contract/scope-resolver.js';
|
||||
import {
|
||||
|
|
@ -119,6 +122,26 @@ const csharpScopeResolver: ScopeResolver = {
|
|||
// `namespace-siblings.ts` for the implementation.
|
||||
populateNamespaceSiblings: populateCsharpNamespaceSiblings,
|
||||
|
||||
isBareClassReceiverCandidate: ({ candidate, spelling, inScope, scopes }) => {
|
||||
if (candidate.typeParameters === undefined || candidate.typeParameters.length === 0)
|
||||
return true;
|
||||
if (spelling.includes('.') || spelling.includes('<') || spelling.includes('::')) return true;
|
||||
if (candidate.qualifiedName?.split('.').at(-1) !== spelling) return true;
|
||||
const claim = lookupNameClaim(inScope, spelling, scopes, { purpose: 'value' });
|
||||
if (claim.imports.some((edge) => edge.kind === 'alias')) return true;
|
||||
const visited = new Set<ScopeId>();
|
||||
let current: ScopeId | null = inScope;
|
||||
while (current !== null && !visited.has(current)) {
|
||||
visited.add(current);
|
||||
const scope = scopes.scopeTree.getScope(current);
|
||||
if (scope === undefined) break;
|
||||
if (scope.kind === 'Class' && scope.ownedDefs.some((def) => def.nodeId === candidate.nodeId))
|
||||
return true;
|
||||
current = scope.parent;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
// C# is statically typed — type information is reliable. Field-
|
||||
// fallback heuristic stays off (the type-binding layer already
|
||||
// produces precise owner types); return-type propagation on is fine
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ import { defineLanguage } from '../language-provider.js';
|
|||
import type { AstFrameworkPatternConfig } from '../language-provider.js';
|
||||
import { typeConfig as dartConfig } from '../type-extractors/dart.js';
|
||||
import { dartExportChecker } from '../export-detection.js';
|
||||
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
||||
import { dartImportConfig } from '../import-resolvers/configs/dart.js';
|
||||
import { DART_QUERIES } from '../tree-sitter-queries.js';
|
||||
import { createDartCfgVisitor } from '../cfg/visitors/dart.js';
|
||||
import { createFieldExtractor } from '../field-extractors/generic.js';
|
||||
|
|
@ -124,7 +122,6 @@ export const dartProvider = defineLanguage({
|
|||
treeSitterQueries: DART_QUERIES,
|
||||
typeConfig: dartConfig,
|
||||
exportChecker: dartExportChecker,
|
||||
importResolver: createImportResolver(dartImportConfig),
|
||||
callExtractor: createCallExtractor(dartCallConfig),
|
||||
fieldExtractor: createFieldExtractor(dartFieldConfig),
|
||||
methodExtractor: createMethodExtractor(dartMethodConfig),
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
* `targetRaw` arrives already quote-stripped from `interpretDartImport`.
|
||||
*/
|
||||
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
import { DART_HERITAGE_PREFIX } from './interpret.js';
|
||||
import type { DartPackageConfig } from './package-config.js';
|
||||
import { DART_PACKAGE_SCHEME, dartPackageImportName } from './package-uri.js';
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ import { createGoCfgVisitor } from '../cfg/visitors/go.js';
|
|||
import { defineLanguage } from '../language-provider.js';
|
||||
import { typeConfig as goConfig } from '../type-extractors/go.js';
|
||||
import { goExportChecker } from '../export-detection.js';
|
||||
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
||||
import { goImportConfig } from '../import-resolvers/configs/go.js';
|
||||
import { GO_QUERIES } from '../tree-sitter-queries.js';
|
||||
import type { AstFrameworkPatternConfig } from '../language-provider.js';
|
||||
import { createFieldExtractor } from '../field-extractors/generic.js';
|
||||
|
|
@ -141,7 +139,6 @@ export const goProvider = defineLanguage({
|
|||
treeSitterQueries: GO_QUERIES,
|
||||
typeConfig: goConfig,
|
||||
exportChecker: goExportChecker,
|
||||
importResolver: createImportResolver(goImportConfig),
|
||||
callExtractor: createCallExtractor(goCallConfig),
|
||||
fieldExtractor: createFieldExtractor(goFieldConfig),
|
||||
methodExtractor: createMethodExtractor(goMethodConfig),
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import {
|
|||
filesInDir,
|
||||
sortedRootFiles,
|
||||
type PackageDirIndex,
|
||||
} from '../../import-resolvers/package-dir-index.js';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
} from '../../utils/package-dir-index.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
import { isGoWorkspaceConfig, locateGoImport } from './workspace-config.js';
|
||||
|
||||
/**
|
||||
|
|
@ -80,7 +80,7 @@ function isGoPackageFile(normalized: string): boolean {
|
|||
*
|
||||
* The orchestrator hands the same Set to every import in a pass, so the index
|
||||
* is built once per run. `resolveGoImportTarget` must therefore never copy the
|
||||
* Set before this point — see `import-resolvers/workspace-file-index.ts`.
|
||||
* Set before this point — see `utils/workspace-file-index.ts`.
|
||||
*/
|
||||
const getGoPackageIndex = perFileSet(
|
||||
(allFilePaths: ReadonlySet<string>): PackageDirIndex =>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,9 @@
|
|||
/**
|
||||
* Go module discovery: every `go.mod` and `go.work` in the repository.
|
||||
*
|
||||
* `loadGoModulePath` reads only the ROOT `go.mod`. A monorepo with one module
|
||||
* per service (`services/orders/go.mod`), a root module with nested modules
|
||||
* (`tools/go.mod`, k8s-style `staging/`), or a repo with no root module at all
|
||||
* then answers every import from the wrong place: with no root `go.mod` the
|
||||
* GOPATH suffix match runs, so two modules' `internal/repository` both answer
|
||||
* `…/internal/repository`; with one, imports of a nested module are "not ours"
|
||||
* and drop, while the root module's own imports match any directory ENDING in
|
||||
* the package path — the nested modules' included.
|
||||
* Every module needs its own root: services may have separate `go.mod` files,
|
||||
* and nested modules own subtrees that an enclosing module cannot import as
|
||||
* its own packages.
|
||||
*
|
||||
* Go itself resolves an import against modules, not directory names:
|
||||
*
|
||||
|
|
|
|||
51
gitnexus/src/core/ingestion/languages/import-candidates.ts
Normal file
51
gitnexus/src/core/ingestion/languages/import-candidates.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/** Ordered fallback candidates supplied by import-resolution providers. */
|
||||
export const EXTENSIONS = [
|
||||
'',
|
||||
// TypeScript/JavaScript
|
||||
'.tsx',
|
||||
'.ts',
|
||||
'.mts',
|
||||
'.cts',
|
||||
'.jsx',
|
||||
'.js',
|
||||
'.mjs',
|
||||
'.cjs',
|
||||
'.vue',
|
||||
'/index.tsx',
|
||||
'/index.ts',
|
||||
'/index.jsx',
|
||||
'/index.js',
|
||||
// Python
|
||||
'.py',
|
||||
'/__init__.py',
|
||||
// Java
|
||||
'.java',
|
||||
// Kotlin
|
||||
'.kt',
|
||||
'.kts',
|
||||
// C/C++
|
||||
'.c',
|
||||
'.h',
|
||||
'.cpp',
|
||||
'.hpp',
|
||||
'.cc',
|
||||
'.cxx',
|
||||
'.hxx',
|
||||
'.hh',
|
||||
'.cu',
|
||||
'.cuh',
|
||||
// C#
|
||||
'.cs',
|
||||
// Go
|
||||
'.go',
|
||||
// Rust
|
||||
'.rs',
|
||||
'/mod.rs',
|
||||
// PHP
|
||||
'.php',
|
||||
'.phtml',
|
||||
// Swift
|
||||
'.swift',
|
||||
// Ruby
|
||||
'.rb',
|
||||
];
|
||||
|
|
@ -23,8 +23,6 @@ import {
|
|||
prepareJavaRouteConstants,
|
||||
} from '../route-extractors/java-const-resolver.js';
|
||||
import { javaExportChecker } from '../export-detection.js';
|
||||
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
||||
import { javaImportConfig } from '../import-resolvers/configs/jvm.js';
|
||||
import { JAVA_QUERIES } from '../tree-sitter-queries.js';
|
||||
import { createCallExtractor } from '../call-extractors/generic.js';
|
||||
import { javaCallConfig } from '../call-extractors/configs/jvm.js';
|
||||
|
|
@ -198,7 +196,6 @@ export const javaProvider = defineLanguage({
|
|||
treeSitterQueries: JAVA_QUERIES,
|
||||
typeConfig: javaTypeConfig,
|
||||
exportChecker: javaExportChecker,
|
||||
importResolver: createImportResolver(javaImportConfig),
|
||||
mroStrategy: 'implements-split',
|
||||
callExtractor: createCallExtractor(javaCallConfig),
|
||||
fieldExtractor: createFieldExtractor(javaConfig),
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
*/
|
||||
|
||||
import type { ParsedFile, ParsedImport, WorkspaceIndex } from 'gitnexus-shared';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
import { getJavaPackageFact } from './package-facts.js';
|
||||
import {
|
||||
buildJavaPackageIndex,
|
||||
|
|
|
|||
|
|
@ -26,9 +26,11 @@
|
|||
* instanceof narrowing passes are duplicated from `typescript/captures.ts`
|
||||
* (they are pure AST operations with no grammar-specific logic).
|
||||
*
|
||||
* Pure given the input source text. No I/O, no globals consulted.
|
||||
* Derives captures from its inputs and records CommonJS classification for
|
||||
* immediate side-channel collection. Performs no I/O.
|
||||
*/
|
||||
|
||||
import { recordCommonJsModuleKind } from '../typescript/module-kind.js';
|
||||
import type { Capture, CaptureMatch } from 'gitnexus-shared';
|
||||
import {
|
||||
findNodeAtRange,
|
||||
|
|
@ -890,6 +892,8 @@ export function emitJsScopeCaptures(
|
|||
});
|
||||
}
|
||||
|
||||
recordCommonJsModuleKind(tree.rootNode, filePath);
|
||||
|
||||
const rawMatches = getJsScopeQuery(grammarPath).matches(tree.rootNode);
|
||||
// Export evidence, read once per file (see `ts-js-export-marker.ts`).
|
||||
const exportEvidence = collectEsmExportEvidence(tree.rootNode, filePath);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
* mapping or a package manifest, and otherwise not at all.
|
||||
*/
|
||||
|
||||
import type { NodeWorkspacePackages } from '../../import-resolvers/node-workspace-packages.js';
|
||||
import type { NodeWorkspacePackages } from '../typescript/workspace-packages.js';
|
||||
import { resolveTsTarget } from '../typescript/import-target.js';
|
||||
import type { TsconfigIndex } from '../typescript/tsconfig.js';
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ import { jsArityCompatibility } from './arity.js';
|
|||
import { makeJsResolveImportTarget } from './import-target.js';
|
||||
import { loadTsconfigIndex } from '../typescript/tsconfig.js';
|
||||
import { typescriptModuleExports } from '../typescript/module-exports.js';
|
||||
import { loadNodeWorkspacePackages } from '../../import-resolvers/node-workspace-packages.js';
|
||||
import { isCommonJsExportAssignment } from '../typescript/cjs-export-receiver.js';
|
||||
import { loadNodeWorkspacePackages } from '../typescript/workspace-packages.js';
|
||||
import { isJsSelfBoundCallableFallbackPlausible } from './callable-visibility.js';
|
||||
|
||||
async function loadResolutionConfig(repoPath: string, fresh = false) {
|
||||
|
|
@ -93,6 +94,8 @@ const javascriptScopeResolver: ScopeResolver = {
|
|||
// JavaScript `super` keyword: same pattern as TypeScript.
|
||||
isSuperReceiver: (text) => /^super(\s*\(|\s*\.|\s*\[|\s*$)/.test(text.trim()),
|
||||
|
||||
isModuleExportAssignment: isCommonJsExportAssignment,
|
||||
|
||||
// JavaScript is dynamically typed — enable the field-fallback heuristic
|
||||
// so member-call receivers without type annotations can still resolve
|
||||
// through declared class fields (e.g. JSDoc-typed fields).
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@ import { createLeadingDocDescriptionExtractor } from '../utils/ast-helpers.js';
|
|||
import { assertCloneable } from '../workers/clone-safety.js';
|
||||
import { kotlinTypeConfig } from '../type-extractors/jvm.js';
|
||||
import { kotlinExportChecker } from '../export-detection.js';
|
||||
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
||||
import { kotlinImportConfig } from '../import-resolvers/configs/jvm.js';
|
||||
import { appendKotlinWildcard } from '../import-resolvers/jvm.js';
|
||||
import { appendKotlinWildcard } from './kotlin/import-wildcard.js';
|
||||
import { KOTLIN_QUERIES } from '../tree-sitter-queries.js';
|
||||
import type { AstFrameworkPatternConfig } from '../language-provider.js';
|
||||
import type { SyntaxNode } from '../utils/ast-helpers.js';
|
||||
|
|
@ -178,7 +176,6 @@ export const kotlinProvider = defineLanguage({
|
|||
treeSitterQueries: KOTLIN_QUERIES,
|
||||
typeConfig: kotlinTypeConfig,
|
||||
exportChecker: kotlinExportChecker,
|
||||
importResolver: createImportResolver(kotlinImportConfig),
|
||||
importPathPreprocessor: appendKotlinWildcard,
|
||||
mroStrategy: 'implements-split',
|
||||
callExtractor: createCallExtractor(kotlinCallConfig),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import type { ParsedFile, ParsedImport, WorkspaceIndex } from 'gitnexus-shared';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
import { getKotlinPackageFact } from './package-facts.js';
|
||||
import {
|
||||
buildKotlinPackageIndex,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
import type { SyntaxNode } from '../../utils/ast-helpers.js';
|
||||
|
||||
/**
|
||||
* Append .* to a Kotlin import path if the AST has a wildcard_import sibling node.
|
||||
* Pure function — returns a new string without mutating the input.
|
||||
*/
|
||||
export const appendKotlinWildcard = (importPath: string, importNode: SyntaxNode): string => {
|
||||
for (let i = 0; i < importNode.childCount; i++) {
|
||||
if (importNode.child(i)?.type === 'wildcard_import') {
|
||||
return importPath.endsWith('.*') ? importPath : `${importPath}.*`;
|
||||
}
|
||||
}
|
||||
return importPath;
|
||||
};
|
||||
|
|
@ -8,7 +8,6 @@ import {
|
|||
import Parser from 'tree-sitter';
|
||||
import { defineLanguage } from '../language-provider.js';
|
||||
import { createObjectiveCCfgVisitor } from '../cfg/visitors/objective-c.js';
|
||||
import type { ImportResolverFn } from '../import-resolvers/types.js';
|
||||
import { getLanguageGrammar } from '../../tree-sitter/parser-loader.js';
|
||||
import { parseSourceSafe } from '../../tree-sitter/safe-parse.js';
|
||||
import { assertCloneable } from '../workers/clone-safety.js';
|
||||
|
|
@ -31,8 +30,6 @@ const EMPTY_TYPE_CONFIG = {
|
|||
extractParameter: () => null,
|
||||
};
|
||||
|
||||
const noImportResolution: ImportResolverFn = () => null;
|
||||
|
||||
function normalizedExt(filePath: string): string {
|
||||
return path.extname(filePath).toLowerCase();
|
||||
}
|
||||
|
|
@ -318,7 +315,6 @@ export const objectiveCProvider = defineLanguage({
|
|||
treeSitterQueries: OBJECTIVE_C_SCOPE_QUERY,
|
||||
typeConfig: EMPTY_TYPE_CONFIG,
|
||||
exportChecker: () => true,
|
||||
importResolver: noImportResolution,
|
||||
classifyFileContent: classifyObjectiveCFileContent,
|
||||
shouldClassifyFileContent: isHeaderPath,
|
||||
preprocessSource: preprocessObjectiveCMacroMarkers,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
import path from 'path';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
import {
|
||||
coerceObjectiveCResolutionConfig,
|
||||
normalizeRepoPath,
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@ import {
|
|||
} from '../language-provider.js';
|
||||
import { typeConfig as phpConfig } from '../type-extractors/php.js';
|
||||
import { phpExportChecker } from '../export-detection.js';
|
||||
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
||||
import { phpImportConfig } from '../import-resolvers/configs/php.js';
|
||||
import { PHP_QUERIES } from '../tree-sitter-queries.js';
|
||||
import {
|
||||
findDescendant,
|
||||
|
|
@ -308,7 +306,6 @@ export const phpProvider = defineLanguage({
|
|||
treeSitterQueries: PHP_QUERIES,
|
||||
typeConfig: phpConfig,
|
||||
exportChecker: phpExportChecker,
|
||||
importResolver: createImportResolver(phpImportConfig),
|
||||
callExtractor: createCallExtractor(phpCallConfig),
|
||||
fieldExtractor: createFieldExtractor(phpFieldConfig),
|
||||
methodExtractor: createMethodExtractor(phpMethodConfig),
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
/**
|
||||
* PHP PSR-4 import resolution — internal helpers.
|
||||
*
|
||||
* Strategy lives in configs/php.ts.
|
||||
* Used by the PHP ScopeResolver.resolveImportTarget hook.
|
||||
* This file contains the shared helper for PSR-4 resolution via composer.json.
|
||||
*/
|
||||
|
||||
import type { SuffixIndex } from './utils.js';
|
||||
import { suffixResolve } from './utils.js';
|
||||
import type { ComposerConfig } from '../language-config.js';
|
||||
import type { SuffixIndex } from '../../utils/suffix-index.js';
|
||||
import { suffixResolve } from '../../utils/suffix-index.js';
|
||||
import type { ComposerConfig } from '../../language-config.js';
|
||||
import { EXTENSIONS } from '../import-candidates.js';
|
||||
|
||||
/** Get or compute the sorted PSR-4 entries (cached after first call). */
|
||||
function getSortedPsr4(config: ComposerConfig): readonly [string, string][] {
|
||||
|
|
@ -142,5 +143,5 @@ export function resolvePhpImportInternal(
|
|||
|
||||
// Fallback: suffix matching (works without composer.json)
|
||||
const pathParts = normalized.split('/').filter(Boolean);
|
||||
return suffixResolve(pathParts, normalizedFileList, allFileList, index);
|
||||
return suffixResolve(pathParts, normalizedFileList, allFileList, EXTENSIONS, index);
|
||||
}
|
||||
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
import type { ParsedFile, ParsedImport, WorkspaceIndex } from 'gitnexus-shared';
|
||||
import type { ImportResolutionContext } from '../../scope-resolution/contract/scope-resolver.js';
|
||||
import { resolvePhpImportInternal } from '../../import-resolvers/php.js';
|
||||
import type { SuffixIndex } from '../../import-resolvers/utils.js';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import { getWorkspaceFileIndex } from '../../import-resolvers/workspace-file-index.js';
|
||||
import { resolvePhpImportInternal } from './import-helpers.js';
|
||||
import type { SuffixIndex } from '../../utils/suffix-index.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
import { getWorkspaceFileIndex } from '../../utils/workspace-file-index.js';
|
||||
import {
|
||||
mergeComposerConfigs,
|
||||
parseComposerConfig,
|
||||
|
|
@ -305,7 +305,7 @@ const getPhpWorkspaceIndex = perFileSet((allFilePaths: ReadonlySet<string>): Php
|
|||
*
|
||||
* DEFERRED for the same reason as the shared `dirMap` (#2903), and here the
|
||||
* case is stronger: `getFilesInDir` has exactly one caller,
|
||||
* `import-resolvers/php.ts`'s PSR-4 function/constant fallback, and that
|
||||
* `import-helpers.ts`'s PSR-4 function/constant fallback, and that
|
||||
* caller sits inside `if (composerConfig) { … }`. `resolvePhpImportTarget`
|
||||
* hard-codes `composerConfig: null`, so on the LanguageProvider path the map
|
||||
* is statically unreachable; on the ScopeResolver path it is reachable only
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ import { defineLanguage } from '../language-provider.js';
|
|||
import type { AstFrameworkPatternConfig } from '../language-provider.js';
|
||||
import { typeConfig as pythonConfig } from '../type-extractors/python.js';
|
||||
import { pythonExportChecker } from '../export-detection.js';
|
||||
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
||||
import { pythonImportConfig } from '../import-resolvers/configs/python.js';
|
||||
import { PYTHON_QUERIES } from '../tree-sitter-queries.js';
|
||||
import { createFieldExtractor } from '../field-extractors/generic.js';
|
||||
import { pythonConfig as pythonFieldConfig } from '../field-extractors/configs/python.js';
|
||||
|
|
@ -130,7 +128,6 @@ export const pythonProvider = defineLanguage({
|
|||
treeSitterQueries: PYTHON_QUERIES,
|
||||
typeConfig: pythonConfig,
|
||||
exportChecker: pythonExportChecker,
|
||||
importResolver: createImportResolver(pythonImportConfig),
|
||||
mroStrategy: 'c3',
|
||||
callExtractor: createCallExtractor(pythonCallConfig),
|
||||
fieldExtractor: createFieldExtractor(pythonFieldConfig),
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* Everything here is derived from `allFilePaths` and nothing here is specific
|
||||
* to either CALLER, and there are two of them on opposite sides of a layer
|
||||
* boundary: `import-resolvers/python.ts` resolves the single-segment bare tier
|
||||
* boundary: `languages/python/import-helpers.ts` resolves the single-segment bare tier
|
||||
* and `languages/python/import-target.ts` resolves the dotted tiers. The second
|
||||
* imports the first, so the index could not live in either without the other
|
||||
* reaching back through a cycle — it used to live in `import-target.ts`, which
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* query functions taking the index.
|
||||
*/
|
||||
|
||||
import { perFileSet } from './per-file-set.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
|
||||
/**
|
||||
* The importer's ancestor directories, CLOSEST FIRST and excluding the
|
||||
|
|
@ -2,8 +2,7 @@
|
|||
* Python import resolution — PEP 328 relative imports and proximity-based bare imports.
|
||||
* Import system spec: PEP 302 (original), PEP 451 (current).
|
||||
*
|
||||
* Strategy lives in configs/python.ts.
|
||||
* This file contains the shared internal helper used by the strategy and tests.
|
||||
* Used by the Python ScopeResolver.resolveImportTarget hook and tests.
|
||||
*/
|
||||
|
||||
import {
|
||||
|
|
@ -11,8 +10,10 @@ import {
|
|||
importerBarePrefixes,
|
||||
importerDirOf,
|
||||
pythonSegmentAbsent,
|
||||
} from './python-file-index.js';
|
||||
import { tryResolveWithExtensions } from './utils.js';
|
||||
} from './import-file-index.js';
|
||||
import { tryResolveWithExtensions } from '../../utils/suffix-index.js';
|
||||
|
||||
const RELATIVE_IMPORT_EXTENSIONS = ['/__init__.py', '.py'] as const;
|
||||
|
||||
/**
|
||||
* Resolve a Python import to a file path (low-level helper).
|
||||
|
|
@ -22,8 +23,6 @@ import { tryResolveWithExtensions } from './utils.js';
|
|||
* Approximates the common case where co-located files find each other without an installed package.
|
||||
* Single-segment only — multi-segment (e.g. `os.path`) falls through to suffixResolve.
|
||||
* Checks package (__init__.py) before module (.py), matching CPython's finder order (PEP 451 §4).
|
||||
* Coexistence of both is physically impossible (same name = file vs directory), so the order
|
||||
* only matters for spec compliance.
|
||||
* Note: implicit namespace packages (Python 3.3+, directory without __init__.py) are not handled.
|
||||
*
|
||||
* Returns null to let the caller fall through to suffixResolve.
|
||||
|
|
@ -50,7 +49,7 @@ export function resolvePythonImportInternal(
|
|||
dirParts.push(...modulePart.replace(/\./g, '/').split('/'));
|
||||
}
|
||||
|
||||
return tryResolveWithExtensions(dirParts.join('/'), allFiles);
|
||||
return tryResolveWithExtensions(dirParts.join('/'), allFiles, RELATIVE_IMPORT_EXTENSIONS);
|
||||
}
|
||||
|
||||
// Proximity bare import — single-segment only; package before module (PEP 451 §4)
|
||||
|
|
@ -11,13 +11,9 @@
|
|||
*/
|
||||
|
||||
import type { ParsedFile, ParsedImport, WorkspaceIndex } from 'gitnexus-shared';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import {
|
||||
getPythonFileIndex,
|
||||
importerAncestors,
|
||||
importerDirOf,
|
||||
} from '../../import-resolvers/python-file-index.js';
|
||||
import { resolvePythonImportInternal } from '../../import-resolvers/python.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
import { getPythonFileIndex, importerAncestors, importerDirOf } from './import-file-index.js';
|
||||
import { resolvePythonImportInternal } from './import-helpers.js';
|
||||
|
||||
export interface PythonResolveContext {
|
||||
readonly fromFile: string;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import { defineLanguage } from '../language-provider.js';
|
||||
import { typeConfig as rTypeConfig } from '../type-extractors/r.js';
|
||||
import { resolveRImport } from './r/import-target.js';
|
||||
import { R_QUERIES } from '../tree-sitter-queries.js';
|
||||
import { RFieldExtractor } from '../field-extractors/r.js';
|
||||
import { rMethodExtractor } from '../method-extractors/r.js';
|
||||
|
|
@ -189,7 +188,6 @@ export const rProvider = defineLanguage({
|
|||
// Every definition is exported by default. NAMESPACE-driven export refinement lives in
|
||||
// `rPostParse`: an `ExportChecker` has no file-path context, and NAMESPACE detection needs it.
|
||||
exportChecker: () => true,
|
||||
importResolver: resolveRImport,
|
||||
fieldExtractor: new RFieldExtractor(),
|
||||
methodExtractor: rMethodExtractor,
|
||||
builtInNames: R_BUILT_INS,
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@
|
|||
*/
|
||||
|
||||
import path from 'path';
|
||||
import type { SuffixIndex } from '../../import-resolvers/utils.js';
|
||||
import { suffixResolve } from '../../import-resolvers/utils.js';
|
||||
import type { SuffixIndex } from '../../utils/suffix-index.js';
|
||||
import { suffixResolve } from '../../utils/suffix-index.js';
|
||||
import { EXTENSIONS } from '../import-candidates.js';
|
||||
import type { ParsedFile } from 'gitnexus-shared';
|
||||
import { rExportPatternMatches, type RPackageConfig } from './package-config.js';
|
||||
import { rBareName } from './bare-name.js';
|
||||
import { rFileTopLevel, rPackageDirForFile, type RFileTopLevel } from './namespace-imports.js';
|
||||
import type { ImportResult, ResolveCtx } from '../../import-resolvers/types.js';
|
||||
import type { ImportResolutionContext } from '../../scope-resolution/contract/scope-resolver.js';
|
||||
import { getWorkspaceFileIndex } from '../../import-resolvers/workspace-file-index.js';
|
||||
import { getWorkspaceFileIndex } from '../../utils/workspace-file-index.js';
|
||||
|
||||
/**
|
||||
* Low-level R import resolver (internal helper).
|
||||
|
|
@ -51,7 +51,7 @@ export function resolveRImportInternal(
|
|||
if (direct !== undefined) return direct;
|
||||
|
||||
const pathParts = cleaned.split('/').filter(Boolean);
|
||||
return suffixResolve(pathParts, normalizedFileList, allFileList, index);
|
||||
return suffixResolve(pathParts, normalizedFileList, allFileList, EXTENSIONS, index);
|
||||
}
|
||||
|
||||
// library("pkg") / require("pkg") — resolve to ALL files in the local package
|
||||
|
|
@ -75,28 +75,7 @@ export function resolveRImportInternal(
|
|||
|
||||
// Fallback: suffix-based resolution
|
||||
const pathParts = cleaned.split('/').filter(Boolean);
|
||||
return suffixResolve(pathParts, normalizedFileList, allFileList, index);
|
||||
}
|
||||
|
||||
/** R: library/require/source resolution via R package config. */
|
||||
export function resolveRImport(
|
||||
rawImportPath: string,
|
||||
filePath: string,
|
||||
ctx: ResolveCtx,
|
||||
): ImportResult {
|
||||
const resolved = resolveRImportInternal(
|
||||
filePath,
|
||||
rawImportPath,
|
||||
ctx.normalizedFileList,
|
||||
ctx.allFileList,
|
||||
// The legacy `ResolveCtx` bundle never carried R's config; the live path is
|
||||
// `resolveRImportTarget` + `loadResolutionConfig`.
|
||||
null,
|
||||
ctx.index,
|
||||
);
|
||||
if (!resolved) return null;
|
||||
const files = Array.isArray(resolved) ? resolved : [resolved];
|
||||
return { kind: 'files', files };
|
||||
return suffixResolve(pathParts, normalizedFileList, allFileList, EXTENSIONS, index);
|
||||
}
|
||||
|
||||
/** Per-package index of top-level definitions, built once per `parsedFiles` array. */
|
||||
|
|
@ -247,7 +226,7 @@ export function resolveRNamedImport(
|
|||
* - Cross-language false-positive guard: a `library()`/`require()` package
|
||||
* name not found in `rConfig.packages` would otherwise fall through to
|
||||
* `resolveRImportInternal`'s generic suffix fallback — and `EXTENSIONS`
|
||||
* (`../../import-resolvers/utils.ts`) has no `.R`/`.r` entry, so a bare R package reference can
|
||||
* (`languages/import-candidates.ts`) has no `.R`/`.r` entry, so a bare R package reference can
|
||||
* suffix-match an unrelated same-named file in another language.
|
||||
* `context.parsedImport.kind === 'wildcard'` is exactly the
|
||||
* `library()`/`require()` shape (see `interpretRImport`), so the guard is
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import type { KnowledgeGraph } from '../../../graph/types.js';
|
|||
import { generateId } from '../../../../lib/utils.js';
|
||||
import { loadRPackageConfig, recordRPackageConfig } from './package-config.js';
|
||||
import { rBareName } from './bare-name.js';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
import { resolveRImportTarget } from './import-target.js';
|
||||
import {
|
||||
isRGlobalNameFallbackPlausible,
|
||||
|
|
|
|||
|
|
@ -23,11 +23,8 @@ import { createLeadingDocDescriptionExtractor, type SyntaxNode } from '../utils/
|
|||
import { typeConfig as rubyConfig } from '../type-extractors/ruby.js';
|
||||
import { routeRubyCall } from '../call-routing.js';
|
||||
import { rubyExportChecker } from '../export-detection.js';
|
||||
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
||||
import { rubyImportConfig } from '../import-resolvers/configs/ruby.js';
|
||||
import { RUBY_QUERIES } from '../tree-sitter-queries.js';
|
||||
import { createFieldExtractor } from '../field-extractors/generic.js';
|
||||
import { rubyConfig as rubyFieldConfig } from '../field-extractors/configs/ruby.js';
|
||||
import { rubyFieldExtractor } from './ruby/field-extractor.js';
|
||||
import { createMethodExtractor } from '../method-extractors/generic.js';
|
||||
import { rubyMethodConfig } from '../method-extractors/configs/ruby.js';
|
||||
import { createVariableExtractor } from '../variable-extractors/generic.js';
|
||||
|
|
@ -214,12 +211,11 @@ export const rubyProvider = defineLanguage({
|
|||
`,
|
||||
typeConfig: rubyConfig,
|
||||
exportChecker: rubyExportChecker,
|
||||
importResolver: createImportResolver(rubyImportConfig),
|
||||
callRouter: routeRubyCall,
|
||||
callExtractor: createCallExtractor(rubyCallConfig),
|
||||
resolveEnclosingOwner: rubyResolveEnclosingOwner,
|
||||
resolveContainerTypeOwner: rubyResolveContainerTypeOwner,
|
||||
fieldExtractor: createFieldExtractor(rubyFieldConfig),
|
||||
fieldExtractor: rubyFieldExtractor,
|
||||
methodExtractor: createMethodExtractor({
|
||||
...rubyMethodConfig,
|
||||
extractFunctionName: rubyExtractFunctionName,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
import type { FieldExtractor } from '../../field-extractor.js';
|
||||
import { createFieldExtractor } from '../../field-extractors/generic.js';
|
||||
import { rubyConfig } from '../../field-extractors/configs/ruby.js';
|
||||
|
||||
const declarationExtractor = createFieldExtractor(rubyConfig);
|
||||
|
||||
export const rubyFieldExtractor: FieldExtractor = {
|
||||
language: declarationExtractor.language,
|
||||
isTypeDeclaration: (node) => declarationExtractor.isTypeDeclaration(node),
|
||||
extract(node, context) {
|
||||
const extracted = declarationExtractor.extract(node, context);
|
||||
if (extracted === null) return null;
|
||||
|
||||
// Accessors describe one property: any setter makes that property writable.
|
||||
const writable = new Set<string>();
|
||||
for (const field of extracted.fields) {
|
||||
if (!field.isReadonly) writable.add(field.name);
|
||||
}
|
||||
for (const field of extracted.fields) {
|
||||
if (writable.has(field.name)) field.isReadonly = false;
|
||||
}
|
||||
return extracted;
|
||||
},
|
||||
};
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
/**
|
||||
* Ruby require/require_relative import resolution — internal helpers.
|
||||
*
|
||||
* Strategy lives in configs/ruby.ts.
|
||||
* This file only contains the low-level helper used by the strategy.
|
||||
* Used by the Ruby ScopeResolver.resolveImportTarget hook.
|
||||
*/
|
||||
|
||||
import type { SuffixIndex } from './utils.js';
|
||||
import { suffixResolve } from './utils.js';
|
||||
import type { SuffixIndex } from '../../utils/suffix-index.js';
|
||||
import { suffixResolve } from '../../utils/suffix-index.js';
|
||||
import { EXTENSIONS } from '../import-candidates.js';
|
||||
|
||||
/**
|
||||
* Resolve a Ruby require/require_relative path to a matching .rb file (low-level helper).
|
||||
|
|
@ -21,5 +21,5 @@ export function resolveRubyImportInternal(
|
|||
index?: SuffixIndex,
|
||||
): string | null {
|
||||
const pathParts = importPath.replace(/^\.\//, '').split('/').filter(Boolean);
|
||||
return suffixResolve(pathParts, normalizedFileList, allFileList, index);
|
||||
return suffixResolve(pathParts, normalizedFileList, allFileList, EXTENSIONS, index);
|
||||
}
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
* - Known external gems → null, even if an unrelated repo file suffix matches
|
||||
*/
|
||||
|
||||
import { resolveRubyImportInternal } from '../../import-resolvers/ruby.js';
|
||||
import { getWorkspaceFileIndex } from '../../import-resolvers/workspace-file-index.js';
|
||||
import { resolveRubyImportInternal } from './import-helpers.js';
|
||||
import { getWorkspaceFileIndex } from '../../utils/workspace-file-index.js';
|
||||
import { isHeritageMarker } from '../../utils/heritage-marker.js';
|
||||
import {
|
||||
findRubyResolutionScope,
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ import { defineLanguage } from '../language-provider.js';
|
|||
import { createLeadingDocDescriptionExtractor, type SyntaxNode } from '../utils/ast-helpers.js';
|
||||
import { typeConfig as rustConfig } from '../type-extractors/rust.js';
|
||||
import { rustExportChecker } from '../export-detection.js';
|
||||
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
||||
import { rustImportConfig } from '../import-resolvers/configs/rust.js';
|
||||
import { RUST_QUERIES } from '../tree-sitter-queries.js';
|
||||
import type { AstFrameworkPatternConfig } from '../language-provider.js';
|
||||
import { createFieldExtractor } from '../field-extractors/generic.js';
|
||||
|
|
@ -168,7 +166,6 @@ export const rustProvider = defineLanguage({
|
|||
treeSitterQueries: RUST_QUERIES,
|
||||
typeConfig: rustConfig,
|
||||
exportChecker: rustExportChecker,
|
||||
importResolver: createImportResolver(rustImportConfig),
|
||||
mroStrategy: 'qualified-syntax',
|
||||
callExtractor: createCallExtractor(rustCallConfig),
|
||||
fieldExtractor: createFieldExtractor(rustFieldConfig),
|
||||
|
|
|
|||
|
|
@ -158,8 +158,16 @@ function findTopLevelComma(text: string): number {
|
|||
return -1;
|
||||
}
|
||||
|
||||
// Preserve possible module-function paths until finalized type bindings can
|
||||
// distinguish module factories from associated functions. Casing is a lint.
|
||||
const RUST_MODULE_FN_PATH_RE =
|
||||
/^(?:(?:r#)?[_\p{XID_Start}][\p{XID_Continue}]*::)+(?:r#)?[_\p{XID_Start}][\p{XID_Continue}]*$/u;
|
||||
|
||||
function normalizeRustCallReturnType(text: string): string {
|
||||
let t = text.trim();
|
||||
let t = text.trim().replace(/\s*::\s*/g, '::');
|
||||
// Kept whole so `resolveQualifiedCallee` can read the function's return
|
||||
// annotation; the head alone would name the module, not a type (#3498).
|
||||
if (!t.startsWith('Self::') && RUST_MODULE_FN_PATH_RE.test(t)) return t;
|
||||
// For scoped calls like `Foo::new()`, extract the type part before `::`
|
||||
const scopeIdx = t.indexOf('::');
|
||||
if (scopeIdx !== -1) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ const SCOPE_TYPES = new Set([
|
|||
'impl_item',
|
||||
'enum_item',
|
||||
'union_item',
|
||||
'type_item',
|
||||
]);
|
||||
|
||||
/** Pattern identifiers own values even when no useful target/type was indexed. */
|
||||
|
|
@ -89,6 +90,10 @@ export function collectRustNameClaims(root: SyntaxNode): ReadonlyMap<number, rea
|
|||
availableFrom: { startLine: node.endPosition.row + 1, startCol: node.endPosition.column },
|
||||
inactive: 'outer',
|
||||
});
|
||||
} else if (node.type === 'type_parameter') {
|
||||
const name = node.childForFieldName('name');
|
||||
if (name !== null)
|
||||
add(ownerOf(node.parent), [name.text], node, { purpose: 'type', hoisted: true });
|
||||
} else if (node.type === 'parameter') {
|
||||
const pattern = node.childForFieldName('pattern');
|
||||
if (pattern !== null) add(ownerOf(node.parent), patternNames(pattern), node);
|
||||
|
|
|
|||
|
|
@ -33,9 +33,13 @@
|
|||
*/
|
||||
|
||||
import type { ParsedFile, Scope, ScopeId, SymbolDefinition } from 'gitnexus-shared';
|
||||
import { perFileSet } from '../../import-resolvers/per-file-set.js';
|
||||
import { perFileSet } from '../../utils/per-file-set.js';
|
||||
import { isOverloadableCallable } from '../../utils/callable-labels.js';
|
||||
import { lookupBindingsAt } from '../../scope-resolution/scope/walkers.js';
|
||||
import {
|
||||
isClassLike,
|
||||
lookupBindingsAt,
|
||||
lookupNameClaim,
|
||||
} from '../../scope-resolution/scope/walkers.js';
|
||||
import type { ScopeResolutionIndexes } from '../../model/scope-resolution-indexes.js';
|
||||
import type { WorkspaceResolutionIndex } from '../../scope-resolution/workspace-index.js';
|
||||
import {
|
||||
|
|
@ -58,9 +62,44 @@ const moduleIndexFor = perFileSet(
|
|||
(allFilePaths: ReadonlySet<string>): RustModuleIndex => buildRustModuleIndex(allFilePaths),
|
||||
);
|
||||
|
||||
/** What path resolution reads off the calling file. */
|
||||
type RustCaller = Pick<ParsedFile, 'filePath' | 'moduleScope'>;
|
||||
|
||||
/** The callee name ending a `::` path (`make` in `crate::modx::make`). */
|
||||
const RUST_PATH_TAIL_RE = /::\s*((?:r#)?[_\p{XID_Start}][\p{XID_Continue}]*)\s*$/u;
|
||||
|
||||
/**
|
||||
* `ScopeResolver.resolveQualifiedCallee`: the function a callee path names
|
||||
* (`rp::make` in `let x = rp::make()` or `rp::make().m()`), resolved over the
|
||||
* module tree exactly like the free call itself, so the call's type and its
|
||||
* CALLS edge cannot disagree (#3498). A type-qualified path (`Foo::new`)
|
||||
* names no module and is refused.
|
||||
*/
|
||||
export function resolveRustQualifiedCallee(
|
||||
calleeText: string,
|
||||
inScope: ScopeId,
|
||||
scopes: ScopeResolutionIndexes,
|
||||
workspaceIndex: WorkspaceResolutionIndex,
|
||||
allFilePaths: ReadonlySet<string>,
|
||||
): SymbolDefinition | undefined {
|
||||
const name = RUST_PATH_TAIL_RE.exec(calleeText)?.[1];
|
||||
if (name === undefined) return undefined;
|
||||
const filePath = scopes.scopeTree.getScope(inScope)?.filePath;
|
||||
if (filePath === undefined) return undefined;
|
||||
const moduleScope = workspaceIndex.moduleScopeByFile.get(filePath);
|
||||
if (moduleScope === undefined) return undefined;
|
||||
return resolveRustQualifiedFreeCall(
|
||||
{ name, rawQualifiedName: calleeText, inScope },
|
||||
{ filePath, moduleScope: moduleScope.id },
|
||||
scopes,
|
||||
workspaceIndex,
|
||||
allFilePaths,
|
||||
);
|
||||
}
|
||||
|
||||
export function resolveRustQualifiedFreeCall(
|
||||
site: { readonly name: string; readonly rawQualifiedName?: string; readonly inScope: ScopeId },
|
||||
callerParsed: ParsedFile,
|
||||
callerParsed: RustCaller,
|
||||
scopes: ScopeResolutionIndexes,
|
||||
workspaceIndex: WorkspaceResolutionIndex,
|
||||
allFilePaths: ReadonlySet<string>,
|
||||
|
|
@ -99,7 +138,13 @@ export function resolveRustQualifiedFreeCall(
|
|||
// which is the part that scales with the workspace.
|
||||
const index = moduleIndexFor(allFilePaths);
|
||||
const pass = passIndexFor(workspaceIndex, index, scopes);
|
||||
if (!couldNameAModule(qualifier, pass.knownModuleNames)) {
|
||||
// A `use crate::modx as rp;` alias is a module name only in this file, so the
|
||||
// workspace-wide filter cannot know it; candidate 2 resolves it.
|
||||
if (
|
||||
!couldNameAModule(qualifier, pass.knownModuleNames) &&
|
||||
importedModulesNamed(qualifier[0], scopes, workspaceIndex, index, site.inScope).next().done ===
|
||||
true
|
||||
) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
@ -117,6 +162,7 @@ export function resolveRustQualifiedFreeCall(
|
|||
scopes,
|
||||
workspaceIndex,
|
||||
index,
|
||||
site.inScope,
|
||||
)) {
|
||||
const hit =
|
||||
findMemberInModule(targetModule, site.name, scopes, workspaceIndex, index) ??
|
||||
|
|
@ -132,7 +178,7 @@ export function resolveRustQualifiedFreeCall(
|
|||
* makes `super::` correct from inside an inline module.
|
||||
*/
|
||||
function callerModuleOf(
|
||||
callerParsed: ParsedFile,
|
||||
callerParsed: RustCaller,
|
||||
inScope: ScopeId,
|
||||
scopes: ScopeResolutionIndexes,
|
||||
index: RustModuleIndex,
|
||||
|
|
@ -166,10 +212,11 @@ function* candidateModules(
|
|||
anchored: { readonly module: RustModule; readonly anchored: boolean },
|
||||
qualifier: readonly string[],
|
||||
callerModule: RustModule,
|
||||
callerParsed: ParsedFile,
|
||||
callerParsed: RustCaller,
|
||||
scopes: ScopeResolutionIndexes,
|
||||
workspaceIndex: WorkspaceResolutionIndex,
|
||||
index: RustModuleIndex,
|
||||
inScope: ScopeId,
|
||||
): Generator<RustModule> {
|
||||
if (anchored.anchored) {
|
||||
yield anchored.module;
|
||||
|
|
@ -188,35 +235,59 @@ function* candidateModules(
|
|||
// A `mod` declaration — inline or file-backed — emits a `Namespace` def
|
||||
// bound in the declaring scope, so the check is a binding lookup.
|
||||
const head = qualifier[0];
|
||||
if (head === undefined) return;
|
||||
const claim = lookupNameClaim(inScope, head, scopes, { purpose: 'type' });
|
||||
if (claim.status !== 'absent' && claim.bindings.length === 0 && claim.imports.length === 0)
|
||||
return;
|
||||
if (
|
||||
head !== undefined &&
|
||||
declaresSubmodule(callerParsed, callerModule, head, workspaceIndex, index, scopes)
|
||||
) {
|
||||
yield { crateRoot: callerModule.crateRoot, segments: [...callerModule.segments, ...qualifier] };
|
||||
claim.bindings.some(
|
||||
(binding) =>
|
||||
isClassLike(binding.def.type) ||
|
||||
binding.def.type === 'Typedef' ||
|
||||
binding.def.type === 'TypeAlias',
|
||||
)
|
||||
)
|
||||
return;
|
||||
if (claim.imports.length > 0) {
|
||||
for (const importedModule of importedModulesNamed(
|
||||
head,
|
||||
scopes,
|
||||
workspaceIndex,
|
||||
index,
|
||||
inScope,
|
||||
)) {
|
||||
yield {
|
||||
crateRoot: importedModule.crateRoot,
|
||||
segments: [...importedModule.segments, ...qualifier.slice(1)],
|
||||
};
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. A `use` binding for the first segment. Finalize already resolved the
|
||||
// import to a file, so the module path comes back through the same
|
||||
// file → module mapping as everything else. Covers `use crate::tools;`,
|
||||
// `use crate::tools::{self}` and `use crate::a::b as tools`.
|
||||
//
|
||||
// The binding must name a MODULE, not a symbol inside one. Import
|
||||
// resolution deliberately strips a trailing symbol segment when probing for
|
||||
// a file ("the last segment might be a symbol, not a module" —
|
||||
// import-resolvers/rust.ts), so `use crate::client::ClientBuilder;` also
|
||||
// lands on `client/mod.rs`. Taking that at face value made the imported
|
||||
// TYPE look like the module `client`, and `ClientBuilder::new()` then
|
||||
// resolved against `client`'s module members — binding an associated
|
||||
// function to an unrelated module-level `new` (#2741 review H2).
|
||||
for (const edge of scopes.imports.get(callerParsed.moduleScope) ?? []) {
|
||||
if (edge.localName !== head || edge.targetFile === null) continue;
|
||||
const importedModule = moduleOfFile(edge.targetFile, index);
|
||||
if (importedModule === undefined) continue;
|
||||
if (!importNamesModule(edge.targetExportedName, importedModule)) continue;
|
||||
yield {
|
||||
crateRoot: importedModule.crateRoot,
|
||||
segments: [...importedModule.segments, ...qualifier.slice(1)],
|
||||
};
|
||||
const namespaces = claim.bindings.filter((binding) => binding.def.type === 'Namespace');
|
||||
if (namespaces.length > 0) {
|
||||
const modules = new Map<string, RustModule>();
|
||||
for (const { def } of namespaces) {
|
||||
const target = moduleOfImport(
|
||||
{ targetFile: def.filePath, targetExportedName: head, targetDefId: def.nodeId },
|
||||
scopes,
|
||||
workspaceIndex,
|
||||
index,
|
||||
);
|
||||
if (target !== undefined)
|
||||
modules.set(`${target.crateRoot}\0${target.segments.join('::')}`, target);
|
||||
}
|
||||
if (modules.size === 1) {
|
||||
const selected = modules.values().next().value!;
|
||||
yield {
|
||||
crateRoot: selected.crateRoot,
|
||||
segments: [...selected.segments, ...qualifier.slice(1)],
|
||||
};
|
||||
}
|
||||
if (modules.size > 0) return;
|
||||
}
|
||||
if (declaresSubmodule(callerParsed, callerModule, head, workspaceIndex, index, scopes)) {
|
||||
yield { crateRoot: callerModule.crateRoot, segments: [...callerModule.segments, ...qualifier] };
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. Crate-root-relative (`a::b::f()` written from a nested module — 2015
|
||||
|
|
@ -239,11 +310,69 @@ function* candidateModules(
|
|||
// callee the source never names. The base emitted no edge at all, and per the
|
||||
// doctrine quoted in `ids.ts` that is the correct failure direction: a missing
|
||||
// edge is recoverable, a fabricated caller silently misleads `impact`.
|
||||
if (callerModule.segments.length > 0 && !headBoundLocally(callerParsed, head, scopes)) {
|
||||
if (
|
||||
claim.status === 'absent' &&
|
||||
callerModule.segments.length > 0 &&
|
||||
!headBoundLocally(callerParsed, head, scopes)
|
||||
) {
|
||||
yield { crateRoot: callerModule.crateRoot, segments: [...qualifier] };
|
||||
}
|
||||
}
|
||||
|
||||
/** Modules selected by the nearest lexical type-namespace import. */
|
||||
function* importedModulesNamed(
|
||||
name: string | undefined,
|
||||
scopes: ScopeResolutionIndexes,
|
||||
workspaceIndex: WorkspaceResolutionIndex,
|
||||
index: RustModuleIndex,
|
||||
inScope: ScopeId,
|
||||
): Generator<RustModule> {
|
||||
if (name === undefined) return;
|
||||
for (const edge of lookupNameClaim(inScope, name, scopes, { purpose: 'type' }).imports) {
|
||||
if (edge.localName !== name) continue;
|
||||
const importedModule = moduleOfImport(edge, scopes, workspaceIndex, index);
|
||||
if (importedModule !== undefined) yield importedModule;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The module a `use` binding names, or `undefined` when it names a symbol.
|
||||
*
|
||||
* Path-based import resolution lands on the module's own file
|
||||
* (`use crate::tools;` → `tools.rs`). Cargo-aware resolution instead binds the
|
||||
* module's DECLARATION — the `Namespace` def `mod tools;` leaves in its parent's
|
||||
* file — so the module is the parent's path plus the def's name. Only a
|
||||
* declaration bound at its file's top level (or carrying its enclosing path in
|
||||
* `namespacePrefix`) is read this way; a nested inline `mod` def records no
|
||||
* enclosing path, and guessing one could name the wrong module.
|
||||
*/
|
||||
function moduleOfImport(
|
||||
edge: {
|
||||
readonly targetFile: string | null;
|
||||
readonly targetExportedName: string;
|
||||
readonly targetDefId?: string;
|
||||
},
|
||||
scopes: ScopeResolutionIndexes,
|
||||
workspaceIndex: WorkspaceResolutionIndex,
|
||||
index: RustModuleIndex,
|
||||
): RustModule | undefined {
|
||||
const declaration =
|
||||
edge.targetDefId === undefined ? undefined : scopes.defs.get(edge.targetDefId);
|
||||
if (declaration !== undefined && declaration.type !== 'Namespace') return undefined;
|
||||
if (declaration?.type === 'Namespace' && declaration.qualifiedName !== undefined) {
|
||||
const name = tailSegment(declaration.qualifiedName);
|
||||
if (!isModuleLevelMember(declaration, name, workspaceIndex)) return undefined;
|
||||
const parent = moduleOfDef(declaration.filePath, declaration.namespacePrefix, index);
|
||||
return parent === undefined
|
||||
? undefined
|
||||
: { crateRoot: parent.crateRoot, segments: [...parent.segments, name] };
|
||||
}
|
||||
if (edge.targetFile === null) return undefined;
|
||||
const importedModule = moduleOfFile(edge.targetFile, index);
|
||||
if (importedModule === undefined) return undefined;
|
||||
return importNamesModule(edge.targetExportedName, importedModule) ? importedModule : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is `name` bound in the caller's own module to anything that is NOT a module?
|
||||
*
|
||||
|
|
@ -253,7 +382,7 @@ function* candidateModules(
|
|||
* case, which candidate 2 already handles, is not double-counted here.
|
||||
*/
|
||||
function headBoundLocally(
|
||||
callerParsed: ParsedFile,
|
||||
callerParsed: RustCaller,
|
||||
name: string | undefined,
|
||||
scopes: ScopeResolutionIndexes,
|
||||
): boolean {
|
||||
|
|
@ -290,7 +419,7 @@ function tailSegment(qualifiedName: string): string {
|
|||
* contributes nothing and cannot outrank a real `use` binding (#2741 review).
|
||||
*/
|
||||
function declaresSubmodule(
|
||||
callerParsed: ParsedFile,
|
||||
callerParsed: RustCaller,
|
||||
callerModule: RustModule,
|
||||
name: string,
|
||||
workspaceIndex: WorkspaceResolutionIndex,
|
||||
|
|
@ -483,7 +612,7 @@ interface PassModuleIndex {
|
|||
}
|
||||
|
||||
/**
|
||||
* DELIBERATELY NOT ON `import-resolvers/per-file-set.ts` (#2909 sweep), unlike
|
||||
* DELIBERATELY NOT ON `utils/per-file-set.ts` (#2909 sweep), unlike
|
||||
* {@link moduleIndexFor} above. {@link passIndexFor} takes THREE inputs —
|
||||
* `workspaceIndex`, `index` and `scopes` — and keys on the first alone; the
|
||||
* builder reads `scopes.defs.byId` and `index`, neither of which is derivable
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ const RUST_SCOPE_QUERY = `
|
|||
(function_signature_item) @scope.function
|
||||
(closure_expression) @scope.function
|
||||
(block) @scope.block
|
||||
(type_item) @scope.block
|
||||
(if_expression) @scope.block
|
||||
(match_expression) @scope.block
|
||||
(match_arm) @scope.block
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { ParsedFile } from 'gitnexus-shared';
|
||||
import type { ParsedFile, TypeRef } from 'gitnexus-shared';
|
||||
import { SupportedLanguages } from 'gitnexus-shared';
|
||||
import { buildMro, defaultLinearize } from '../../scope-resolution/passes/mro.js';
|
||||
import type { ScopeResolver } from '../../scope-resolution/contract/scope-resolver.js';
|
||||
|
|
@ -6,7 +6,7 @@ import { indexOnlyElementType } from '../../type-extractors/shared.js';
|
|||
import { rustProvider } from '../rust.js';
|
||||
import { rustArityCompatibility, rustMergeBindings, resolveRustImportTarget } from './index.js';
|
||||
import { populateRustOwners } from './method-owners.js';
|
||||
import { resolveRustQualifiedFreeCall } from './qualified-call.js';
|
||||
import { resolveRustQualifiedCallee, resolveRustQualifiedFreeCall } from './qualified-call.js';
|
||||
import { populateRustRangeBindings } from './range-binding.js';
|
||||
import {
|
||||
isClassLike,
|
||||
|
|
@ -170,6 +170,33 @@ export const rustScopeResolver: ScopeResolver = {
|
|||
resolveQualifiedFreeCall: (site, callerParsed, scopes, workspaceIndex, allFilePaths) =>
|
||||
resolveRustQualifiedFreeCall(site, callerParsed, scopes, workspaceIndex, allFilePaths),
|
||||
|
||||
resolveQualifiedCallee: resolveRustQualifiedCallee,
|
||||
|
||||
// A qualified initializer may name either a module factory or an associated
|
||||
// function. Restore the constructor's type only after lexical type ownership
|
||||
// is known, before imported-return propagation follows the remaining paths.
|
||||
populateNamespaceSiblings: (parsedFiles, scopes) => {
|
||||
for (const parsed of parsedFiles) {
|
||||
for (const scope of parsed.scopes) {
|
||||
for (const [name, ref] of scope.typeBindings) {
|
||||
if (ref.source !== 'constructor-inferred') continue;
|
||||
const separator = ref.rawName.lastIndexOf('::');
|
||||
if (separator < 1) continue;
|
||||
const owner = ref.rawName.slice(0, separator);
|
||||
if (
|
||||
findClassBindingInScope(ref.declaredAtScope, owner, scopes, undefined, {
|
||||
uniqueQualifiedNameFallback: false,
|
||||
purpose: 'type',
|
||||
position: ref.lookupPosition ?? ref.bindingRange,
|
||||
}) !== undefined
|
||||
) {
|
||||
(scope.typeBindings as Map<string, TypeRef>).set(name, { ...ref, rawName: owner });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
buildMro: (graph, parsedFiles, nodeLookup) => buildRustMro(graph, parsedFiles, nodeLookup),
|
||||
|
||||
emitHeritageEdges: (graph, parsedFiles, nodeLookup, scopes, recordTypeArguments) =>
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ import { defineLanguage } from '../language-provider.js';
|
|||
import type { AstFrameworkPatternConfig } from '../language-provider.js';
|
||||
import { typeConfig as swiftConfig } from '../type-extractors/swift.js';
|
||||
import { swiftExportChecker } from '../export-detection.js';
|
||||
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
||||
import { swiftImportConfig } from '../import-resolvers/configs/swift.js';
|
||||
import { SWIFT_QUERIES } from '../tree-sitter-queries.js';
|
||||
import type { SyntaxNode } from '../utils/ast-helpers.js';
|
||||
import { createLeadingDocDescriptionExtractor } from '../utils/ast-helpers.js';
|
||||
|
|
@ -239,7 +237,6 @@ export const swiftProvider = defineLanguage({
|
|||
treeSitterQueries: SWIFT_QUERIES,
|
||||
typeConfig: swiftConfig,
|
||||
exportChecker: swiftExportChecker,
|
||||
importResolver: createImportResolver(swiftImportConfig),
|
||||
callExtractor: createCallExtractor(swiftCallConfig),
|
||||
fieldExtractor: createFieldExtractor(swiftFieldConfig),
|
||||
methodExtractor: createMethodExtractor({
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue