gitnexus 1.6.5 → 1.6.6-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_shared/index.d.ts +1 -1
- package/dist/_shared/index.d.ts.map +1 -1
- package/dist/_shared/index.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/context.d.ts +27 -0
- package/dist/_shared/scope-resolution/registries/context.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/context.js.map +1 -1
- package/dist/_shared/scope-resolution/symbol-definition.d.ts +7 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts.map +1 -1
- package/dist/core/ingestion/language-provider.d.ts +29 -0
- package/dist/core/ingestion/languages/c-cpp.js +46 -0
- package/dist/core/ingestion/languages/cpp/arity-metadata.d.ts +8 -0
- package/dist/core/ingestion/languages/cpp/arity-metadata.js +1 -1
- package/dist/core/ingestion/languages/cpp/arity.d.ts +4 -1
- package/dist/core/ingestion/languages/cpp/arity.js +4 -1
- package/dist/core/ingestion/languages/cpp/captures.js +70 -0
- package/dist/core/ingestion/languages/cpp/constraint-extractor.d.ts +73 -0
- package/dist/core/ingestion/languages/cpp/constraint-extractor.js +308 -0
- package/dist/core/ingestion/languages/cpp/constraint-filter.d.ts +31 -0
- package/dist/core/ingestion/languages/cpp/constraint-filter.js +135 -0
- package/dist/core/ingestion/languages/cpp/scope-resolver.js +6 -0
- package/dist/core/ingestion/languages/cpp/type-classifier.d.ts +26 -0
- package/dist/core/ingestion/languages/cpp/type-classifier.js +49 -0
- package/dist/core/ingestion/parsing-processor.js +33 -2
- package/dist/core/ingestion/scope-extractor.js +17 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +21 -1
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.d.ts +1 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +14 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +12 -0
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +11 -1
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +50 -21
- package/dist/core/ingestion/scope-resolution/passes/overload-narrowing.d.ts +30 -7
- package/dist/core/ingestion/scope-resolution/passes/overload-narrowing.js +49 -18
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.d.ts +1 -1
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +10 -4
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +1 -0
- package/dist/core/ingestion/utils/template-arguments.d.ts +19 -0
- package/dist/core/ingestion/utils/template-arguments.js +30 -0
- package/package.json +1 -1
package/dist/_shared/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export type { RawSignals } from './scope-resolution/registries/evidence.js';
|
|
|
41
41
|
export { compareByConfidenceWithTiebreaks, CONFIDENCE_EPSILON, } from './scope-resolution/registries/tie-breaks.js';
|
|
42
42
|
export type { TieBreakKey } from './scope-resolution/registries/tie-breaks.js';
|
|
43
43
|
export { CLASS_KINDS, METHOD_KINDS, FIELD_KINDS } from './scope-resolution/registries/context.js';
|
|
44
|
-
export type { RegistryContext, RegistryProviders, OwnerScopedContributor, ArityVerdict, } from './scope-resolution/registries/context.js';
|
|
44
|
+
export type { RegistryContext, RegistryProviders, OwnerScopedContributor, ArityVerdict, ConstraintContext, } from './scope-resolution/registries/context.js';
|
|
45
45
|
export { makeScopeId, clearScopeIdInternPool } from './scope-resolution/scope-id.js';
|
|
46
46
|
export type { ScopeIdInput } from './scope-resolution/scope-id.js';
|
|
47
47
|
export { buildScopeTree, canParentScope, ScopeTreeInvariantError, } from './scope-resolution/scope-tree.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,E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O,EACL,cAAc,EACd,cAAc,EACd,uBAAuB,GACxB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,8EAA8E;AAC9E,wEAAwE;AACxE,wEAAwE;AACxE,8DAA8D;AAC9D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAEjG,OAAO,EACL,cAAc,EACd,4BAA4B,EAC5B,kBAAkB,EAClB,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAG3C,mDAAmD;AACnD,OAAO,EACL,+BAA+B,EAC/B,6BAA6B,EAC7B,4BAA4B,EAC5B,sBAAsB,EACtB,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,GACf,MAAM,sCAAsC,CAAC;AAG9C,gEAAgE;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAMpE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC"}
|
|
@@ -26,8 +26,35 @@ export interface RegistryProviders {
|
|
|
26
26
|
* when absent, every candidate receives `'unknown'` (neutral signal).
|
|
27
27
|
*/
|
|
28
28
|
arityCompatibility?(callsite: Callsite, def: SymbolDefinition): ArityVerdict;
|
|
29
|
+
/**
|
|
30
|
+
* Language-specific constraint compatibility between a callsite and a
|
|
31
|
+
* candidate `def`. Mirrors `arityCompatibility` and shares its three-valued
|
|
32
|
+
* verdict shape; the third value `'unknown'` MUST keep the candidate
|
|
33
|
+
* (monotonicity: adding a predicate can only narrow correctly, never
|
|
34
|
+
* produce a wrong edge). Consulted by `narrowOverloadCandidates` after
|
|
35
|
+
* arity + type filters when a candidate carries `templateConstraints`.
|
|
36
|
+
*
|
|
37
|
+
* Optional; when absent the constraint filter is a pass-through. Languages
|
|
38
|
+
* with no constrained-overload semantics leave this undefined.
|
|
39
|
+
*/
|
|
40
|
+
constraintCompatibility?(callsite: Callsite, def: SymbolDefinition, ctx: ConstraintContext): ArityVerdict;
|
|
29
41
|
}
|
|
30
42
|
export type ArityVerdict = 'compatible' | 'unknown' | 'incompatible';
|
|
43
|
+
/**
|
|
44
|
+
* Context threaded into `constraintCompatibility`. Kept minimal in the
|
|
45
|
+
* Tier-A scope (only `argumentTypes`, riding here until a separate
|
|
46
|
+
* `Callsite`-widening refactor moves them onto the call site directly).
|
|
47
|
+
* Future Tier-B graph-aware predicates (`is_base_of_v`, etc.) will widen
|
|
48
|
+
* this interface with `lookupTypeByName` and similar helpers.
|
|
49
|
+
*/
|
|
50
|
+
export interface ConstraintContext {
|
|
51
|
+
/**
|
|
52
|
+
* Per-slot argument types at the call site, normalized per the language
|
|
53
|
+
* adapter. Empty string means unknown. Same convention as
|
|
54
|
+
* `narrowOverloadCandidates`' `argTypes` parameter.
|
|
55
|
+
*/
|
|
56
|
+
readonly argumentTypes?: readonly string[];
|
|
57
|
+
}
|
|
31
58
|
/**
|
|
32
59
|
* Per-owner membership view plugged into `LookupParams.ownerScopedContributor`.
|
|
33
60
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/scope-resolution/registries/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,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E,SAAS,MAAM,EAAE,CAAC;CAC5C;AAID;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,sBAAsB;IACrC,sEAAsE;IACtE,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;IAC3B;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,gBAAgB,EAAE,CAAC;CACnD;AAID,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,cAAc,EAAE,kBAAkB,CAAC;IAC5C,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,mBAAmB,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;CACvC;AAOD,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAc1C,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,SAAS,SAAS,EAI3C,CAAC;AAEH,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAK1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/scope-resolution/registries/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/scope-resolution/registries/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAkGH,8EAA8E;AAC9E,EAAE;AACF,0EAA0E;AAC1E,6DAA6D;AAE7D,MAAM,CAAC,MAAM,WAAW,GAAyB,MAAM,CAAC,MAAM,CAAC;IAC7D,OAAO;IACP,WAAW;IACX,MAAM;IACN,QAAQ;IACR,OAAO;IACP,OAAO;IACP,WAAW;IACX,SAAS;IACT,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,UAAU;IACV,WAAW;CACZ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAyB,MAAM,CAAC,MAAM,CAAC;IAC9D,QAAQ;IACR,UAAU;IACV,aAAa;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAyB,MAAM,CAAC,MAAM,CAAC;IAC7D,UAAU;IACV,UAAU;IACV,OAAO;IACP,QAAQ;CACT,CAAC,CAAC"}
|
|
@@ -30,6 +30,13 @@ export interface SymbolDefinition {
|
|
|
30
30
|
declaredType?: string;
|
|
31
31
|
/** Generic/template specialization arguments for class-like symbols (e.g. ['User'], ['T*']). */
|
|
32
32
|
templateArguments?: string[];
|
|
33
|
+
/** Per-language constraint payload for template / generic overloads
|
|
34
|
+
* (e.g. C++ `enable_if_t<P, T>` predicate trees, C++20 `requires` clauses).
|
|
35
|
+
* Opaque to shared code — the producing language adapter owns the shape
|
|
36
|
+
* and is the only consumer. Read via the optional
|
|
37
|
+
* `ScopeResolver.constraintCompatibility` hook during overload narrowing.
|
|
38
|
+
* Absent for symbols that have no constraints (the common case). */
|
|
39
|
+
templateConstraints?: unknown;
|
|
33
40
|
/** Links Method/Constructor/Property to owning Class/Struct/Trait nodeId */
|
|
34
41
|
ownerId?: string;
|
|
35
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbol-definition.d.ts","sourceRoot":"","sources":["../../src/scope-resolution/symbol-definition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB;;+FAE2F;IAC3F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;iHAC6G;IAC7G,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;uFACmF;IACnF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gGAAgG;IAChG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gGAAgG;IAChG,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
1
|
+
{"version":3,"file":"symbol-definition.d.ts","sourceRoot":"","sources":["../../src/scope-resolution/symbol-definition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB;;+FAE2F;IAC3F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;iHAC6G;IAC7G,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;uFACmF;IACnF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gGAAgG;IAChG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gGAAgG;IAChG,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B;;;;;yEAKqE;IACrE,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -155,6 +155,35 @@ interface LanguageProviderConfig {
|
|
|
155
155
|
funcName: string;
|
|
156
156
|
label: NodeLabel;
|
|
157
157
|
} | null;
|
|
158
|
+
/**
|
|
159
|
+
* Extract a per-language template-constraint payload for a templated
|
|
160
|
+
* function / method definition. Used by `parsing-processor` to
|
|
161
|
+
* disambiguate same-name same-arity overloads whose distinguishing
|
|
162
|
+
* signal is their template constraints rather than their parameter
|
|
163
|
+
* types — the canonical C++ SFINAE case (issue #1579):
|
|
164
|
+
*
|
|
165
|
+
* template<class T, std::enable_if_t<is_integral_v<T>, int> = 0>
|
|
166
|
+
* void process(T); // overload A
|
|
167
|
+
*
|
|
168
|
+
* template<class T, std::enable_if_t<is_floating_point_v<T>, int> = 0>
|
|
169
|
+
* void process(T); // overload B
|
|
170
|
+
*
|
|
171
|
+
* Both overloads' `parameterTypes` collapse to `['T']`, so without a
|
|
172
|
+
* constraint fingerprint in the graph node ID they merge into one
|
|
173
|
+
* Function node and the resolver only ever sees one candidate to
|
|
174
|
+
* narrow. The hook's return value is stamped onto the node's ID via
|
|
175
|
+
* `templateConstraintsIdTag()` AND stored on the node's
|
|
176
|
+
* `templateConstraints` property so `resolveDefGraphId` can look up
|
|
177
|
+
* the right overload by re-hashing the def's constraints at resolve
|
|
178
|
+
* time.
|
|
179
|
+
*
|
|
180
|
+
* Returns the opaque payload (any JSON-serializable shape — the
|
|
181
|
+
* producing adapter owns it; shared code MUST NOT inspect) or
|
|
182
|
+
* `undefined` when no constraints exist / the node isn't a templated
|
|
183
|
+
* function. Languages without SFINAE / concept semantics leave this
|
|
184
|
+
* undefined and the disambiguation is a pass-through.
|
|
185
|
+
*/
|
|
186
|
+
readonly extractTemplateConstraints?: (definitionNode: SyntaxNode) => unknown;
|
|
158
187
|
/** Override the default node label for definition.function captures.
|
|
159
188
|
* Return null to skip (C/C++ duplicate), a different label to reclassify
|
|
160
189
|
* (e.g., 'Method' for Kotlin), or defaultLabel to keep as-is.
|
|
@@ -39,6 +39,7 @@ import { createHeritageExtractor } from '../heritage-extractors/generic.js';
|
|
|
39
39
|
import { stripUeMacros } from '../cpp-ue-preprocessor.js';
|
|
40
40
|
import { emitCScopeCaptures, interpretCImport, interpretCTypeBinding, cArityCompatibility, cBindingScopeFor, cImportOwningScope, cReceiverBinding, } from './c/index.js';
|
|
41
41
|
import { emitCppScopeCaptures, interpretCppImport, interpretCppTypeBinding, cppArityCompatibility, cppBindingScopeFor, cppImportOwningScope, cppReceiverBinding, } from './cpp/index.js';
|
|
42
|
+
import { extractCppTemplateConstraints } from './cpp/constraint-extractor.js';
|
|
42
43
|
const C_BUILT_INS = new Set([
|
|
43
44
|
'printf',
|
|
44
45
|
'fprintf',
|
|
@@ -417,6 +418,7 @@ export const cppProvider = defineLanguage({
|
|
|
417
418
|
heritageExtractor: createHeritageExtractor(SupportedLanguages.CPlusPlus),
|
|
418
419
|
labelOverride: cppLabelOverride,
|
|
419
420
|
builtInNames: C_BUILT_INS,
|
|
421
|
+
extractTemplateConstraints: extractCppTemplateConstraintsForProvider,
|
|
420
422
|
// ── RFC #909 Ring 3: scope-based resolution hooks (RFC §5) ──────────
|
|
421
423
|
emitScopeCaptures: emitCppScopeCaptures,
|
|
422
424
|
interpretImport: interpretCppImport,
|
|
@@ -427,3 +429,47 @@ export const cppProvider = defineLanguage({
|
|
|
427
429
|
arityCompatibility: cppArityCompatibility,
|
|
428
430
|
// mergeBindings + resolveImportTarget live on ScopeResolver (see cpp/scope-resolver.ts).
|
|
429
431
|
});
|
|
432
|
+
/**
|
|
433
|
+
* LanguageProvider hook: walk from a function definition node up to its
|
|
434
|
+
* enclosing `template_declaration` and extract the SFINAE / `requires`-
|
|
435
|
+
* clause constraint payload. Used by `parsing-processor` to fingerprint
|
|
436
|
+
* the graph node ID so two SFINAE overloads with identical
|
|
437
|
+
* `parameterTypes` get distinct nodes (issue #1579).
|
|
438
|
+
*
|
|
439
|
+
* Returns `undefined` for non-templated functions and for templated
|
|
440
|
+
* functions whose constraints the extractor can't model — both cases
|
|
441
|
+
* result in no constraint suffix on the node ID.
|
|
442
|
+
*/
|
|
443
|
+
function extractCppTemplateConstraintsForProvider(definitionNode) {
|
|
444
|
+
// Walk up to the enclosing template_declaration. Bound the walk so we
|
|
445
|
+
// can't accidentally land on a far-ancestor template_declaration that
|
|
446
|
+
// wraps an unrelated function.
|
|
447
|
+
let cur = definitionNode.parent;
|
|
448
|
+
let hops = 8;
|
|
449
|
+
let templateDecl = null;
|
|
450
|
+
while (cur !== null && hops-- > 0) {
|
|
451
|
+
if (cur.type === 'template_declaration') {
|
|
452
|
+
templateDecl = cur;
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
if (cur.type === 'translation_unit')
|
|
456
|
+
break;
|
|
457
|
+
cur = cur.parent;
|
|
458
|
+
}
|
|
459
|
+
if (templateDecl === null)
|
|
460
|
+
return undefined;
|
|
461
|
+
// Find the function_declarator inside the function definition so the
|
|
462
|
+
// extractor can map template params to function-argument indices.
|
|
463
|
+
let declarator = definitionNode.childForFieldName('declarator');
|
|
464
|
+
let walk = 8;
|
|
465
|
+
while (declarator !== null && walk-- > 0) {
|
|
466
|
+
if (declarator.type === 'function_declarator')
|
|
467
|
+
break;
|
|
468
|
+
if (declarator.type === 'pointer_declarator' || declarator.type === 'reference_declarator') {
|
|
469
|
+
declarator = declarator.childForFieldName('declarator');
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
break;
|
|
473
|
+
}
|
|
474
|
+
return extractCppTemplateConstraints(templateDecl, declarator);
|
|
475
|
+
}
|
|
@@ -16,3 +16,11 @@ export declare function computeCppDeclarationArity(node: SyntaxNode): CppArityIn
|
|
|
16
16
|
* Compute call-site arity from a call_expression node.
|
|
17
17
|
*/
|
|
18
18
|
export declare function computeCppCallArity(node: SyntaxNode): number;
|
|
19
|
+
/**
|
|
20
|
+
* Normalize a C++ parameter type for overload disambiguation.
|
|
21
|
+
* Maps common qualified/aliased types to their canonical short forms
|
|
22
|
+
* so that `narrowOverloadCandidates` can match against literal-inferred
|
|
23
|
+
* argument types (e.g. `inferCppLiteralType` returns `'string'` for
|
|
24
|
+
* string literals, not `'std::string'`).
|
|
25
|
+
*/
|
|
26
|
+
export declare function normalizeCppParamType(raw: string): string;
|
|
@@ -103,7 +103,7 @@ export function computeCppCallArity(node) {
|
|
|
103
103
|
* argument types (e.g. `inferCppLiteralType` returns `'string'` for
|
|
104
104
|
* string literals, not `'std::string'`).
|
|
105
105
|
*/
|
|
106
|
-
function normalizeCppParamType(raw) {
|
|
106
|
+
export function normalizeCppParamType(raw) {
|
|
107
107
|
let t = raw.trim();
|
|
108
108
|
// Strip const, volatile, etc.
|
|
109
109
|
t = t.replace(/\b(const|volatile|restrict|mutable|constexpr)\b/g, '').trim();
|
|
@@ -7,7 +7,10 @@ import type { Callsite, SymbolDefinition } from '../../../../_shared/index.js';
|
|
|
7
7
|
* - Default parameters (requiredParameterCount < parameterCount)
|
|
8
8
|
* - Variadic functions (C-style `...`)
|
|
9
9
|
* - Parameter packs (V1: treated as variadic)
|
|
10
|
-
* - Templates
|
|
10
|
+
* - Templates: arity check on non-template params; SFINAE / `requires`
|
|
11
|
+
* constraints are filtered separately via `constraintCompatibility`
|
|
12
|
+
* (see `constraint-filter.ts` and issue #1579). Type-argument generic
|
|
13
|
+
* substitution (`List<T>` ≡ `List<U>`) remains out of V1 scope.
|
|
11
14
|
*
|
|
12
15
|
* Verdict:
|
|
13
16
|
* - 'compatible': callsite.arity fits within [required, total] range
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
* - Default parameters (requiredParameterCount < parameterCount)
|
|
7
7
|
* - Variadic functions (C-style `...`)
|
|
8
8
|
* - Parameter packs (V1: treated as variadic)
|
|
9
|
-
* - Templates
|
|
9
|
+
* - Templates: arity check on non-template params; SFINAE / `requires`
|
|
10
|
+
* constraints are filtered separately via `constraintCompatibility`
|
|
11
|
+
* (see `constraint-filter.ts` and issue #1579). Type-argument generic
|
|
12
|
+
* substitution (`List<T>` ≡ `List<U>`) remains out of V1 scope.
|
|
10
13
|
*
|
|
11
14
|
* Verdict:
|
|
12
15
|
* - 'compatible': callsite.arity fits within [required, total] range
|
|
@@ -8,6 +8,7 @@ import { markCppAnonymousNamespaceRange, markFileLocal } from './file-local-link
|
|
|
8
8
|
import { markCppDependentBase } from './two-phase-lookup.js';
|
|
9
9
|
import { markCppAdlSiteArgs, markCppAdlSiteNoAdl } from './adl.js';
|
|
10
10
|
import { markCppInlineNamespaceRange } from './inline-namespaces.js';
|
|
11
|
+
import { extractCppTemplateConstraints } from './constraint-extractor.js';
|
|
11
12
|
export function emitCppScopeCaptures(sourceText, filePath, cachedTree) {
|
|
12
13
|
let tree = cachedTree;
|
|
13
14
|
if (tree === undefined) {
|
|
@@ -99,6 +100,19 @@ export function emitCppScopeCaptures(sourceText, filePath, cachedTree) {
|
|
|
99
100
|
markFileLocal(filePath, nameText);
|
|
100
101
|
}
|
|
101
102
|
}
|
|
103
|
+
// SFINAE / `requires`-clause aware constraints for overload
|
|
104
|
+
// narrowing (issue #1579). Walk from the enclosing
|
|
105
|
+
// `template_declaration` — not the inner `function_definition` —
|
|
106
|
+
// so inline method templates (`template<...> class C { template<...> void f(); }`)
|
|
107
|
+
// pick up the correct outer constraint scope.
|
|
108
|
+
const templateDecl = findEnclosingTemplateDeclaration(fnNode);
|
|
109
|
+
if (templateDecl !== null) {
|
|
110
|
+
const funcDeclarator = findFunctionDeclarator(fnNode);
|
|
111
|
+
const constraints = extractCppTemplateConstraints(templateDecl, funcDeclarator);
|
|
112
|
+
if (constraints !== undefined) {
|
|
113
|
+
grouped['@declaration.template-constraints'] = syntheticCapture('@declaration.template-constraints', fnNode, JSON.stringify(constraints));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
102
116
|
}
|
|
103
117
|
}
|
|
104
118
|
// ── Detect static variables (file-local linkage) ────────────────
|
|
@@ -484,6 +498,53 @@ function extractBaseLookupName(baseNode) {
|
|
|
484
498
|
}
|
|
485
499
|
return '';
|
|
486
500
|
}
|
|
501
|
+
/**
|
|
502
|
+
* Walk parent chain from a function_definition / declaration / field_declaration
|
|
503
|
+
* to find the enclosing `template_declaration`. Returns null when the function
|
|
504
|
+
* isn't templated. The walk only ascends through wrapper nodes the C++
|
|
505
|
+
* grammar inserts between `template_declaration` and the function — direct
|
|
506
|
+
* parent in the common case, two hops for member templates whose outer
|
|
507
|
+
* class is also templated (we return the INNERMOST template_declaration,
|
|
508
|
+
* which carries this function's own template parameters).
|
|
509
|
+
*/
|
|
510
|
+
function findEnclosingTemplateDeclaration(fnNode) {
|
|
511
|
+
let cur = fnNode.parent;
|
|
512
|
+
// Cap the walk — `template_declaration` is typically the immediate parent
|
|
513
|
+
// or one wrapper away. Anything deeper is an inline-method-in-template
|
|
514
|
+
// shape and we still want the innermost templates_declaration whose body
|
|
515
|
+
// wraps `fnNode`.
|
|
516
|
+
let hops = 8;
|
|
517
|
+
while (cur !== null && hops-- > 0) {
|
|
518
|
+
if (cur.type === 'template_declaration')
|
|
519
|
+
return cur;
|
|
520
|
+
// Don't ascend past structural boundaries that should reset template scope.
|
|
521
|
+
if (cur.type === 'translation_unit')
|
|
522
|
+
return null;
|
|
523
|
+
cur = cur.parent;
|
|
524
|
+
}
|
|
525
|
+
return null;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Locate the `function_declarator` AST node within a function definition
|
|
529
|
+
* or declaration. Unwraps pointer/reference declarator wrappers. Returns
|
|
530
|
+
* null when no function_declarator is found (e.g. variable declaration
|
|
531
|
+
* mis-classified upstream).
|
|
532
|
+
*/
|
|
533
|
+
function findFunctionDeclarator(fnNode) {
|
|
534
|
+
const direct = fnNode.childForFieldName('declarator');
|
|
535
|
+
let cur = direct;
|
|
536
|
+
let hops = 8;
|
|
537
|
+
while (cur !== null && hops-- > 0) {
|
|
538
|
+
if (cur.type === 'function_declarator')
|
|
539
|
+
return cur;
|
|
540
|
+
if (cur.type === 'pointer_declarator' || cur.type === 'reference_declarator') {
|
|
541
|
+
cur = cur.childForFieldName('declarator');
|
|
542
|
+
continue;
|
|
543
|
+
}
|
|
544
|
+
break;
|
|
545
|
+
}
|
|
546
|
+
return findFirstDescendantOfType(fnNode, 'function_declarator');
|
|
547
|
+
}
|
|
487
548
|
/** Find the first direct child matching one of the given types. */
|
|
488
549
|
function findChildOfType(node, types) {
|
|
489
550
|
for (let i = 0; i < node.childCount; i++) {
|
|
@@ -589,6 +650,15 @@ function inferCppLiteralType(node) {
|
|
|
589
650
|
* - `int n = ...` → 'int'
|
|
590
651
|
* - `const int n = ...` → 'int'
|
|
591
652
|
* Returns empty string if no declaration found or type is auto/placeholder.
|
|
653
|
+
*
|
|
654
|
+
* Limitation: only `declaration` siblings inside the enclosing
|
|
655
|
+
* `compound_statement` are inspected. Function parameters live in the
|
|
656
|
+
* `function_declarator`'s `parameter_list` and are NOT resolved here, so
|
|
657
|
+
* `void run(int n) { process(n); }`
|
|
658
|
+
* infers `''` for `n` and the constraint filter falls through to
|
|
659
|
+
* `'unknown'` → ambiguity suppression → 0 CALLS edges. This is a
|
|
660
|
+
* "degrade not lie" gap (no wrong edges, just missing ones); extending
|
|
661
|
+
* the scan to `parameter_list` is tracked under #1579 as a follow-up.
|
|
592
662
|
*/
|
|
593
663
|
function lookupDeclaredTypeForIdentifier(identNode) {
|
|
594
664
|
const varName = identNode.text;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract C++ template constraint expressions for SFINAE-aware overload
|
|
3
|
+
* narrowing (issue #1579). Recognizes 3 AST shapes:
|
|
4
|
+
*
|
|
5
|
+
* F1 — unqualified non-type template param default:
|
|
6
|
+
* `template<class T, enable_if_t<P, int> = 0> void f(T);`
|
|
7
|
+
* F2 — `std::`-qualified variant (canonical ticket form):
|
|
8
|
+
* `template<class T, std::enable_if_t<P, int> = 0> void f(T);`
|
|
9
|
+
* F4 — C++20 leading requires-clause:
|
|
10
|
+
* `template<class T> requires P void f(T);`
|
|
11
|
+
*
|
|
12
|
+
* Deferred (return `{kind:'unknown'}`):
|
|
13
|
+
* F3 — void-default `typename = enable_if_t<P>` (cppref labels this
|
|
14
|
+
* `/* WRONG *\/` because adjacent overloads collapse to redeclarations)
|
|
15
|
+
* F5 — trailing requires (`void f(T) requires P;`)
|
|
16
|
+
* `requires_expression` blocks (`requires { typename T::U; }`)
|
|
17
|
+
* `decltype(...)`, fold-expressions, user-defined `_v` aliases.
|
|
18
|
+
*
|
|
19
|
+
* The output payload is opaque to shared code — only
|
|
20
|
+
* `constraint-filter.ts` consumes it. See ISO `[temp.constr.normal]` /
|
|
21
|
+
* `<https://en.cppreference.com/w/cpp/language/constraints>` for the
|
|
22
|
+
* normalization the Kleene 3-valued evaluator implements.
|
|
23
|
+
*/
|
|
24
|
+
import type { SyntaxNode } from '../../utils/ast-helpers.js';
|
|
25
|
+
export type ConstraintExpr = {
|
|
26
|
+
readonly kind: 'atomic';
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly args: readonly string[];
|
|
29
|
+
} | {
|
|
30
|
+
readonly kind: 'and';
|
|
31
|
+
readonly children: readonly ConstraintExpr[];
|
|
32
|
+
} | {
|
|
33
|
+
readonly kind: 'or';
|
|
34
|
+
readonly children: readonly ConstraintExpr[];
|
|
35
|
+
} | {
|
|
36
|
+
readonly kind: 'not';
|
|
37
|
+
readonly child: ConstraintExpr;
|
|
38
|
+
} | {
|
|
39
|
+
readonly kind: 'unknown';
|
|
40
|
+
};
|
|
41
|
+
export interface CppConstraintPayload {
|
|
42
|
+
/** Ordered template parameter names (type-params only — non-type defaults
|
|
43
|
+
* carrying enable_if predicates are folded into `expr`). */
|
|
44
|
+
readonly templateParams: readonly string[];
|
|
45
|
+
/**
|
|
46
|
+
* Mapping from each template parameter name to the call-site argument
|
|
47
|
+
* index where its deduced type lives. Computed by scanning the function's
|
|
48
|
+
* parameter list for the first parameter whose type is the bare template
|
|
49
|
+
* parameter name (or template-typed by it). Missing entries → 'unknown'
|
|
50
|
+
* verdict at evaluation time.
|
|
51
|
+
*/
|
|
52
|
+
readonly paramArgIndex: {
|
|
53
|
+
readonly [paramName: string]: number;
|
|
54
|
+
};
|
|
55
|
+
/** Root constraint expression. When multiple constraints (multiple
|
|
56
|
+
* enable_if defaults, requires clause, etc.) are present they are
|
|
57
|
+
* implicitly conjoined under a top-level `and` node. */
|
|
58
|
+
readonly expr: ConstraintExpr;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Walk a `template_declaration` AST node and extract its constraint
|
|
62
|
+
* payload. Caller is responsible for passing the OUTER `template_declaration`
|
|
63
|
+
* — for class-member template functions, that means the enclosing
|
|
64
|
+
* template_declaration of the class OR of the method, whichever
|
|
65
|
+
* directly precedes the function definition.
|
|
66
|
+
*
|
|
67
|
+
* Returns `undefined` when the template_declaration declares no
|
|
68
|
+
* constraints worth tracking (no enable_if default, no requires clause).
|
|
69
|
+
* Returns a payload whose `expr.kind === 'unknown'` when constraints are
|
|
70
|
+
* present but the extractor cannot model them — monotonicity guarantees
|
|
71
|
+
* the filter keeps the candidate in that case.
|
|
72
|
+
*/
|
|
73
|
+
export declare function extractCppTemplateConstraints(templateDecl: SyntaxNode, funcDeclarator: SyntaxNode | null): CppConstraintPayload | undefined;
|