chore(vendor): update tree-sitter-dart to 1.0.0-g0038280 (#3633)

* chore(vendor): update tree-sitter-dart to 1.0.0-g0038280

* chore(vendor): rebuild native prebuilds (tree-sitter-dart)

Built by https://github.com/abhigyanpatwari/GitNexus/actions/runs/39212887661

* fix(dart): use native extension type parsing

The upgraded grammar parses extension types directly. The compatibility
rewrite loses generic extension bodies and implements clauses, so capture
the native nodes and register their member ownership instead.

Refresh the Dart capture fingerprint after comparing the old grammar and
emitter over the same fixture corpus. Keep the scaling budget unchanged.

Refs #3633

* chore(vendor): rebuild native prebuilds (tree-sitter-dart)

Built by https://github.com/abhigyanpatwari/GitNexus/actions/runs/39239767139

* fix: repair Dart parity and checkpoint regressions

Remove Dart from the preprocessing fixture inventory after retiring its
hook. Use the parsed body boundary when reading extension-type heritage
so named-record representations retain their implements clauses.

Seed the WAL recovery fixture with the normal checkpoint threshold, then
force one-byte checkpoints only for the deliberately blocked write.
Require an actual error exit instead of accepting a subprocess timeout.

Refs #3633

* chore(vendor): rebuild native prebuilds (tree-sitter-dart)

Built by https://github.com/abhigyanpatwari/GitNexus/actions/runs/39248441688

---------

Co-authored-by: gitnexus-release-bot[bot] <gitnexus-release-bot[bot]@users.noreply.github.com>
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
This commit is contained in:
gitnexus-release-bot[bot] 2026-10-19 15:41:34 +01:00 • committed by GitHub
parent 89602560d3
commit 47d63a0601
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 175236 additions and 164257 deletions

View file

@ -161,7 +161,7 @@
"_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: swift-callable-alternatives/App.swift (+1 file, +36 groups). Emitter delta: +6 / -3: `??` and ternary seeds and copies now name each operand; the 3 removed matches are the whole-expression seeds and copy that carried a `target-qualified-name` / `source-qualified-name` of the compound source. capture_groups_fp 1297 -> 1333, fixture_count 67 -> 68; synthetic counts unchanged; scaling 1.057 < 1.5. Prior decf74c01af0c7f403e203b19c2bd92dbf95b4562f6da2b0ac5117ef872204da -> c9fc553662f0db18027fba882e3ff730744f6153cc46eca7b00667fabd6a0df8." "_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: swift-callable-alternatives/App.swift (+1 file, +36 groups). Emitter delta: +6 / -3: `??` and ternary seeds and copies now name each operand; the 3 removed matches are the whole-expression seeds and copy that carried a `target-qualified-name` / `source-qualified-name` of the compound source. capture_groups_fp 1297 -> 1333, fixture_count 67 -> 68; synthetic counts unchanged; scaling 1.057 < 1.5. Prior decf74c01af0c7f403e203b19c2bd92dbf95b4562f6da2b0ac5117ef872204da -> c9fc553662f0db18027fba882e3ff730744f6153cc46eca7b00667fabd6a0df8."
}, },
"dart": { "dart": {
"fingerprint": "557bdc505af40590b21e53298584f14227b7d79220806425f8e7da25d78f9712", "fingerprint": "4690403d2be0d270e28a55791df82eaa627d26d28c52d81bfafa59761badcaf3",
"scaling_budget": 1.5, "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_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 \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.",
@ -172,7 +172,8 @@
"_added": "#939: dart added to the scope-capture bench with the registry-primary migration. Heritage-bearing scale source (Entity extends Base implements Marker) gates the @reference.inherits synth + the postfix-chain reference walk at scale. emitDartScopeCaptures threads tree-sitter captured nodes (no findNodeAtRange root-walk), so it is linear (~1.0).", "_added": "#939: dart added to the scope-capture bench with the registry-primary migration. Heritage-bearing scale source (Entity extends Base implements Marker) gates the @reference.inherits synth + the postfix-chain reference walk at scale. emitDartScopeCaptures threads tree-sitter captured nodes (no findNodeAtRange root-walk), so it is linear (~1.0).",
"_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": "#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_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: dart-callable-alternatives/app.dart (+1 file, +33 groups). Emitter delta: +6 / -3: `??` and `?:` seeds and copies now name each operand; the 3 removed matches are the whole-expression seeds and copy that carried a qualified name of the compound source. capture_groups_fp 829 -> 862, fixture_count 36 -> 37; synthetic counts unchanged; scaling 1.033 < 1.5. Prior 3a8ddabbeb1cba47a4757451d4f79d726ca230fd15e860772b11526fbb1c6687 -> 795290a9524ee0dc38af635536e9744c401ec13828ec77822d39e59e1cd6e649.", "_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: dart-callable-alternatives/app.dart (+1 file, +33 groups). Emitter delta: +6 / -3: `??` and `?:` seeds and copies now name each operand; the 3 removed matches are the whole-expression seeds and copy that carried a qualified name of the compound source. capture_groups_fp 829 -> 862, fixture_count 36 -> 37; synthetic counts unchanged; scaling 1.033 < 1.5. Prior 3a8ddabbeb1cba47a4757451d4f79d726ca230fd15e860772b11526fbb1c6687 -> 795290a9524ee0dc38af635536e9744c401ec13828ec77822d39e59e1cd6e649.",
"_rebaselined_3486_semantic_rename": "#3486: Compared actual origin/main (191a954b), committed dd3bf and frozen provider source over the same unchanged corpus. 2 existing prefixed package imports retain their explicit aliases (http/tool). Import sources, statement spans and all other matches are unchanged. Fixture entries 43; changed entries 1; capture groups 895 -> 895. 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. 2 existing prefixed package imports retain their explicit aliases (http/tool). Import sources, statement spans and all other matches are unchanged. Fixture entries 43; changed entries 1; capture groups 895 -> 895. Fingerprint regenerated from the runner's canonicalized capture records. Scaling budgets unchanged.",
"_rebaselined_3633_native_extension_types": "#3633: Compared the prior grammar and emitter at 89602560d with native extension-type capture over the same 42 Dart fixture files. Only dart-extension-types/models.dart changes: 11 module/type scope and declaration matches retain the original header text, and Box's declaration gains type-parameter metadata. All method, receiver and heritage captures are unchanged. Total capture groups remain 895 across 43 fixture/synthetic entries; synthetic scale counts stay 5011/16011. Measured scaling 1.127 < 1.5; budget unchanged. Prior 557bdc505af40590b21e53298584f14227b7d79220806425f8e7da25d78f9712 -> 4690403d2be0d270e28a55791df82eaa627d26d28c52d81bfafa59761badcaf3."
}, },
"java": { "java": {
"fingerprint": "41c4338f5813a73199dd5c2609313c11076812df21fd9c429039a833325870e0", "fingerprint": "41c4338f5813a73199dd5c2609313c11076812df21fd9c429039a833325870e0",

View file

@ -5,6 +5,16 @@ import type { ClassExtractionConfig } from '../../class-types.js';
export const dartClassConfig: ClassExtractionConfig = { export const dartClassConfig: ClassExtractionConfig = {
language: SupportedLanguages.Dart, language: SupportedLanguages.Dart,
typeDeclarationNodes: ['class_definition', 'extension_declaration', 'enum_declaration'], typeDeclarationNodes: [
ancestorScopeNodeTypes: ['class_definition', 'extension_declaration', 'enum_declaration'], 'class_definition',
'extension_declaration',
'extension_type_declaration',
'enum_declaration',
],
ancestorScopeNodeTypes: [
'class_definition',
'extension_declaration',
'extension_type_declaration',
'enum_declaration',
],
}; };

View file

@ -47,7 +47,6 @@ import {
dartArityCompatibility, dartArityCompatibility,
} from './dart/index.js'; } from './dart/index.js';
import { DART_BUILT_INS } from './dart/built-ins.js'; import { DART_BUILT_INS } from './dart/built-ins.js';
import { preprocessDartExtensionTypes } from './dart/extension-type-preprocess.js';
/** /**
* Resolve the enclosing function from a `function_body` node by looking at its * Resolve the enclosing function from a `function_body` node by looking at its
@ -123,7 +122,6 @@ export const dartProvider = defineLanguage({
}, },
] satisfies AstFrameworkPatternConfig[], ] satisfies AstFrameworkPatternConfig[],
treeSitterQueries: DART_QUERIES, treeSitterQueries: DART_QUERIES,
preprocessSource: preprocessDartExtensionTypes,
typeConfig: dartConfig, typeConfig: dartConfig,
exportChecker: dartExportChecker, exportChecker: dartExportChecker,
importResolver: createImportResolver(dartImportConfig), importResolver: createImportResolver(dartImportConfig),

View file

@ -39,7 +39,6 @@ import { computeDartArityMetadata } from './arity-metadata.js';
import { synthesizeDartReceiverBinding } from './receiver-binding.js'; import { synthesizeDartReceiverBinding } from './receiver-binding.js';
import { synthesizeDartSignatureBindings } from './signature-bindings.js'; import { synthesizeDartSignatureBindings } from './signature-bindings.js';
import { getDartParser, getDartScopeQuery } from './query.js'; import { getDartParser, getDartScopeQuery } from './query.js';
import { preprocessDartExtensionTypes } from './extension-type-preprocess.js';
import { recordCacheHit, recordCacheMiss } from './cache-stats.js'; import { recordCacheHit, recordCacheMiss } from './cache-stats.js';
import { getTreeSitterBufferSize } from '../../constants.js'; import { getTreeSitterBufferSize } from '../../constants.js';
import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js'; import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
@ -156,17 +155,13 @@ export function emitDartScopeCaptures(
_filePath: string, _filePath: string,
cachedTree?: unknown, cachedTree?: unknown,
): readonly CaptureMatch[] { ): readonly CaptureMatch[] {
// Idempotent re-application: `extractParsedFile` already preprocesses, but
// direct emitter callers (benchmarks, capture goldens) must see the same
// program the pipeline does.
const parseText = preprocessDartExtensionTypes(sourceText);
let tree: Parser.Tree; let tree: Parser.Tree;
if (cachedTree !== undefined && cachedTree !== null) { if (cachedTree !== undefined && cachedTree !== null) {
tree = cachedTree as Parser.Tree; tree = cachedTree as Parser.Tree;
recordCacheHit(); recordCacheHit();
} else { } else {
tree = parseSourceSafe(getDartParser(), parseText, undefined, { tree = parseSourceSafe(getDartParser(), sourceText, undefined, {
bufferSize: getTreeSitterBufferSize(parseText), bufferSize: getTreeSitterBufferSize(sourceText),
}); });
recordCacheMiss(); recordCacheMiss();
} }
@ -311,7 +306,7 @@ export function emitDartScopeCaptures(
emitDartFieldAssignmentBindings(node, out, memo); emitDartFieldAssignmentBindings(node, out, memo);
return; return;
} }
if (node.type === 'extension_declaration') { if (node.type === 'extension_declaration' || node.type === 'extension_type_declaration') {
emitExtensionImplementsHeritage(node, out); emitExtensionImplementsHeritage(node, out);
return; return;
} }
@ -1129,8 +1124,11 @@ function emitExtensionImplementsHeritage(extensionNode: SyntaxNode, out: Capture
const nameNode = extensionNode.childForFieldName('name'); const nameNode = extensionNode.childForFieldName('name');
if (nameNode === null) return; if (nameNode === null) return;
const bodyStart = extensionNode.text.indexOf('{'); const body = extensionNode.childForFieldName('body');
const header = bodyStart === -1 ? extensionNode.text : extensionNode.text.slice(0, bodyStart); const header =
body === null
? extensionNode.text
: extensionNode.text.slice(0, body.startIndex - extensionNode.startIndex);
const implementsIndex = header.indexOf('implements'); const implementsIndex = header.indexOf('implements');
if (implementsIndex === -1) return; if (implementsIndex === -1) return;

View file

@ -1,46 +0,0 @@
const DART_EXTENSION_TYPE_HEADER =
/\b(extension)([ \t]+type[ \t]+(?:const[ \t]+)?)([A-Za-z_$][A-Za-z0-9_$]*)([ \t]*<[^()\r\n]*>)?([ \t]*)\(([^()\r\n]*)\)/g;
function representationType(representation: string): string | null {
const trimmed = representation.trim();
const match = /^(.*\S)\s+[A-Za-z_$][A-Za-z0-9_$]*$/.exec(trimmed);
const typeName = match?.[1]?.trim();
return typeName && typeName.length > 0 ? typeName : null;
}
/**
* Rewrites Dart 3.3 `extension type Name(Type value)` headers into ordinary
* extension headers before tree-sitter sees the source. The vendored grammar
* currently recovers these declarations through an ERROR subtree, while the
* existing Dart ingestion path already handles `extension Name on Type`.
*/
export function preprocessDartExtensionTypes(sourceText: string): string {
return sourceText.replace(
DART_EXTENSION_TYPE_HEADER,
(
match,
extensionKeyword: string,
extensionTypeGap: string,
name: string,
typeParameters: string | undefined,
beforeRepresentation: string,
representation: string,
) => {
const typeName = representationType(representation);
if (typeName === null) return match;
const representationSpanLength = beforeRepresentation.length + representation.length + 2;
const rewrittenRepresentation = ` on ${typeName}`;
if (rewrittenRepresentation.length > representationSpanLength) return match;
return (
extensionKeyword +
' '.repeat(extensionTypeGap.length) +
name +
(typeParameters ?? '') +
rewrittenRepresentation +
' '.repeat(representationSpanLength - rewrittenRepresentation.length)
);
},
);
}

View file

@ -2,8 +2,8 @@
* The Dart scope-capture tree-sitter query (`DART_SCOPE_QUERY`) plus lazy * The Dart scope-capture tree-sitter query (`DART_SCOPE_QUERY`) plus lazy
* `Parser`/`Query` singletons. Mirror of `languages/swift/query.ts`. * `Parser`/`Query` singletons. Mirror of `languages/swift/query.ts`.
* *
* Verified against tree-sitter-dart 1.0.0 (UserNobody14, commit 80e23c07, * Verified against tree-sitter-dart 1.0.0-g0038280 (UserNobody14,
* ABI 14) — every node type below also appears in the legacy `DART_QUERIES`, * ABI 15) — every node type below also appears in the legacy `DART_QUERIES`,
* which is validated against the same grammar. * which is validated against the same grammar.
* *
* NOTE: This query intentionally covers ONLY the constructs that map cleanly * NOTE: This query intentionally covers ONLY the constructs that map cleanly
@ -39,6 +39,7 @@ const DART_SCOPE_QUERY = `
(class_definition) @scope.class (class_definition) @scope.class
(mixin_declaration) @scope.class (mixin_declaration) @scope.class
(extension_declaration) @scope.class (extension_declaration) @scope.class
(extension_type_declaration) @scope.class
(enum_declaration) @scope.class (enum_declaration) @scope.class
; ── Declarations — types ───────────────────────────────────────────────────── ; ── Declarations — types ─────────────────────────────────────────────────────
@ -53,6 +54,9 @@ const DART_SCOPE_QUERY = `
(type_parameters)? @declaration.type-parameters) @declaration.class (type_parameters)? @declaration.type-parameters) @declaration.class
(mixin_declaration (identifier) @declaration.name) @declaration.trait (mixin_declaration (identifier) @declaration.name) @declaration.trait
(extension_declaration name: (identifier) @declaration.name) @declaration.class (extension_declaration name: (identifier) @declaration.name) @declaration.class
(extension_type_declaration
name: (identifier) @declaration.name
type_parameters: (type_parameters)? @declaration.type-parameters) @declaration.class
(enum_declaration name: (identifier) @declaration.name) @declaration.enum (enum_declaration name: (identifier) @declaration.name) @declaration.enum
; ── Declarations — type aliases (old-style + new-style function typedefs) ──── ; ── Declarations — type aliases (old-style + new-style function typedefs) ────

View file

@ -23,6 +23,7 @@ const TYPE_DECL_TYPES = new Set([
'class_definition', 'class_definition',
'mixin_declaration', 'mixin_declaration',
'extension_declaration', 'extension_declaration',
'extension_type_declaration',
'enum_declaration', 'enum_declaration',
]); ]);

View file

@ -406,7 +406,12 @@ function extractDartAnnotations(node: SyntaxNode): string[] {
export const dartMethodConfig: MethodExtractionConfig = { export const dartMethodConfig: MethodExtractionConfig = {
language: SupportedLanguages.Dart, language: SupportedLanguages.Dart,
typeDeclarationNodes: ['class_definition', 'mixin_declaration', 'extension_declaration'], typeDeclarationNodes: [
'class_definition',
'mixin_declaration',
'extension_declaration',
'extension_type_declaration',
],
methodNodeTypes: ['method_signature', 'declaration'], methodNodeTypes: ['method_signature', 'declaration'],
bodyNodeTypes: ['class_body', 'extension_body'], bodyNodeTypes: ['class_body', 'extension_body'],

View file

@ -2604,7 +2604,7 @@ export const SWIFT_QUERIES = `
`; `;
// Dart queries - works with tree-sitter-dart (UserNobody14/tree-sitter-dart, ABI 14) // Dart queries - works with tree-sitter-dart (UserNobody14/tree-sitter-dart, ABI 15)
// Note: Dart grammar has function_signature/method_signature as wrappers; // Note: Dart grammar has function_signature/method_signature as wrappers;
// top-level functions are (program > function_signature), // top-level functions are (program > function_signature),
// methods inside classes are (method_signature > function_signature). // methods inside classes are (method_signature > function_signature).
@ -2622,6 +2622,8 @@ export const DART_QUERIES = `
; ── Extensions ─────────────────────────────────────────────────────────────── ; ── Extensions ───────────────────────────────────────────────────────────────
(extension_declaration (extension_declaration
name: (identifier) @name) @definition.class name: (identifier) @name) @definition.class
(extension_type_declaration
name: (identifier) @name) @definition.class
; ── Enums ──────────────────────────────────────────────────────────────────── ; ── Enums ────────────────────────────────────────────────────────────────────
(enum_declaration (enum_declaration

View file

@ -363,6 +363,7 @@ export const CLASS_CONTAINER_TYPES = new Set([
// Dart // Dart
'mixin_declaration', 'mixin_declaration',
'extension_declaration', 'extension_declaration',
'extension_type_declaration',
// Ruby // Ruby
'class', 'class',
'module', 'module',
@ -430,6 +431,7 @@ export const CONTAINER_TYPE_TO_LABEL: Record<string, string> = {
protocol_declaration: 'Interface', protocol_declaration: 'Interface',
mixin_declaration: 'Mixin', mixin_declaration: 'Mixin',
extension_declaration: 'Class', extension_declaration: 'Class',
extension_type_declaration: 'Class',
class: 'Class', class: 'Class',
// Ruby `module` declarations map to `Trait` so they participate in the // Ruby `module` declarations map to `Trait` so they participate in the
// class-like type registry used by `lookupClassByName` / inheritance // class-like type registry used by `lookupClassByName` / inheritance

View file

@ -72,7 +72,7 @@ afterAll(() => {
if (suiteGitnexusHome) cleanupTempDirSync(suiteGitnexusHome); if (suiteGitnexusHome) cleanupTempDirSync(suiteGitnexusHome);
}); });
const runAnalyze = () => const runAnalyze = (walCheckpointThreshold: string) =>
spawnSync(process.execPath, [...CLI_SPAWN_PREFIX, 'analyze', '--skip-skills'], { spawnSync(process.execPath, [...CLI_SPAWN_PREFIX, 'analyze', '--skip-skills'], {
cwd: repoPath, cwd: repoPath,
encoding: 'utf8', encoding: 'utf8',
@ -85,9 +85,7 @@ const runAnalyze = () =>
GITNEXUS_HOME: suiteGitnexusHome, GITNEXUS_HOME: suiteGitnexusHome,
// Skip ensureHeap re-exec (which drops the tsx loader). // Skip ensureHeap re-exec (which drops the tsx loader).
NODE_OPTIONS: `${process.env.NODE_OPTIONS || ''} --max-old-space-size=8192`.trim(), NODE_OPTIONS: `${process.env.NODE_OPTIONS || ''} --max-old-space-size=8192`.trim(),
// Tiny threshold forces auto-checkpoint on every write so the GITNEXUS_WAL_CHECKPOINT_THRESHOLD: walCheckpointThreshold,
// first write into the WAL trips the planted rename blocker.
GITNEXUS_WAL_CHECKPOINT_THRESHOLD: '1',
CI: '1', CI: '1',
}, },
}); });
@ -105,8 +103,10 @@ describe('analyze WAL auto-checkpoint rename failure (real lbug, no mocks)', ()
// 1) Clean full analyze (no blocker) — builds the index into staging and // 1) Clean full analyze (no blocker) — builds the index into staging and
// swaps it in. Must succeed; the staging checkpoint name is unblocked. // swaps it in. Must succeed; the staging checkpoint name is unblocked.
const first = runAnalyze(); // Use the normal 64 MiB threshold while seeding the index. Checkpointing
expect(first.status === null ? 'timeout' : first.status).toBe(0); // every setup write needlessly stalls schema and FTS creation on Windows.
const first = runAnalyze('67108864');
expect(first.status === null ? 'timeout' : first.status, first.stderr).toBe(0);
// 2) Change a tracked source file and commit, so the next analyze is an // 2) Change a tracked source file and commit, so the next analyze is an
// incremental writeback (in-place), not a full rebuild. // incremental writeback (in-place), not a full rebuild.
@ -138,12 +138,12 @@ describe('analyze WAL auto-checkpoint rename failure (real lbug, no mocks)', ()
fs.writeFileSync(path.join(blockerDir, 'blocker'), 'cannot-be-renamed-over'); fs.writeFileSync(path.join(blockerDir, 'blocker'), 'cannot-be-renamed-over');
// 4) Incremental analyze into the blocked checkpoint target. // 4) Incremental analyze into the blocked checkpoint target.
const result = runAnalyze(); const result = runAnalyze('1');
const combined = `${result.stderr}\n${result.stdout}`; const combined = `${result.stderr}\n${result.stdout}`;
// The CLI must exit non-zero. status === null means the timeout fired // The blocked checkpoint must produce an error, rather than a timeout.
// without a clean exit — also a failure for this assertion. expect(result.status, combined).not.toBeNull();
expect(result.status === null ? 'timeout' : result.status).not.toBe(0); expect(result.status).not.toBe(0);
// Recovery hint must reference the CLI flag and the recommended // Recovery hint must reference the CLI flag and the recommended
// 64 MiB threshold (67_108_864 bytes). Both come from the // 64 MiB threshold (67_108_864 bytes). Both come from the

View file

@ -34,7 +34,7 @@ import {
} from '../../../src/core/tree-sitter/parser-loader.js'; } from '../../../src/core/tree-sitter/parser-loader.js';
import { SupportedLanguages } from '../../../src/config/supported-languages.js'; import { SupportedLanguages } from '../../../src/config/supported-languages.js';
import type { CaptureMatch } from 'gitnexus-shared'; import type { CaptureMatch } from 'gitnexus-shared';
import { preprocessDartExtensionTypes } from '../../../src/core/ingestion/languages/dart/extension-type-preprocess.js'; import { getDartParser } from '../../../src/core/ingestion/languages/dart/query.js';
let dartAvailable = isLanguageAvailable(SupportedLanguages.Dart); let dartAvailable = isLanguageAvailable(SupportedLanguages.Dart);
if (dartAvailable) { if (dartAvailable) {
@ -146,18 +146,35 @@ describe.skipIf(!dartAvailable)('F28 — Dart typedef capture (scope layer)', ()
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
describe.skipIf(!dartAvailable)('Dart extension type declarations (scope layer)', () => { describe.skipIf(!dartAvailable)('Dart extension type declarations (scope layer)', () => {
it('rewrites extension type headers without changing source length or line count', () => { it('parses native extension types without errors and preserves declaration positions', () => {
const rewritten = preprocessDartExtensionTypes(EXTENSION_TYPES); const tree = getDartParser().parse(EXTENSION_TYPES);
expect(rewritten).toHaveLength(EXTENSION_TYPES.length); expect(tree.rootNode.hasError).toBe(false);
expect(rewritten.split('\n')).toHaveLength(EXTENSION_TYPES.split('\n').length); const matches = emitDartScopeCaptures(EXTENSION_TYPES, 'test.dart', tree);
for (const name of ['UserId', 'EmptyId', 'Celsius', 'Box', 'Pair']) { const declarations = matches.filter((match) => match['@declaration.class']);
expect(rewritten.indexOf(name)).toBe(EXTENSION_TYPES.indexOf(name)); for (const name of ['UserId', 'EmptyId', 'Celsius', 'Box', 'Pair', 'Fancy']) {
const declaration = declarations.find((match) => match['@declaration.name']?.text === name);
const precedingLines = EXTENSION_TYPES.slice(0, EXTENSION_TYPES.indexOf(name)).split('\n');
expect(declaration?.['@declaration.name']?.range).toMatchObject({
startLine: precedingLines.length,
startCol: precedingLines.at(-1)?.length,
});
} }
expect(rewritten).toContain('UserId on String'); });
expect(rewritten).toContain('EmptyId on String');
expect(rewritten).toContain('Celsius on double'); it('captures generic extension type parameters', () => {
expect(rewritten).toContain('Box<T> on List<T>'); const matches = emitDartScopeCaptures(EXTENSION_TYPES, 'test.dart');
expect(rewritten).toContain('Pair on String'); const box = matches.find((match) => match['@declaration.name']?.text === 'Box');
expect(box?.['@declaration.type-parameters']?.text).toBe('<T>');
});
it('binds this inside extension type methods to the owning type', () => {
const matches = emitDartScopeCaptures(EXTENSION_TYPES, 'test.dart');
const receivers = matches
.filter((match) => match['@type-binding.name']?.text === 'this')
.map((match) => match['@type-binding.type']?.text);
expect(receivers).toEqual(
expect.arrayContaining(['UserId', 'Celsius', 'Box', 'Pair', 'Fancy']),
);
}); });
it('captures extension types as class-like declarations', () => { it('captures extension types as class-like declarations', () => {
@ -178,6 +195,16 @@ describe.skipIf(!dartAvailable)('Dart extension type declarations (scope layer)'
); );
expect(imports).not.toContain('__heritage__:implements:int:Pair'); expect(imports).not.toContain('__heritage__:implements:int:Pair');
}); });
it('captures implements clauses after named-record representation types', () => {
const imports = heritageImports(
'extension type RecordId(({String id}) value) implements Identifiable, Comparator<String, int> {}',
);
expect(imports).toEqual([
'__heritage__:implements:Identifiable:RecordId',
'__heritage__:implements:Comparator:RecordId',
]);
});
}); });
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View file

@ -44,10 +44,6 @@ const FIXTURES: Partial<Record<SupportedLanguages, { filePath: string; source: s
'', '',
].join('\n'), ].join('\n'),
}, },
[SupportedLanguages.Dart]: {
filePath: 'meters.dart',
source: ['extension type Meters(int value) {', ' int get raw => value;', '}', ''].join('\n'),
},
[SupportedLanguages.ObjectiveC]: { [SupportedLanguages.ObjectiveC]: {
filePath: 'Marker.m', filePath: 'Marker.m',
source: [ source: [

View file

@ -1,12 +1,12 @@
{ {
"name": "tree-sitter-dart", "name": "tree-sitter-dart",
"version": "1.0.0-gbe07cf7", "version": "1.0.0-g0038280",
"description": "Dart grammar attempt for tree-sitter", "description": "Dart grammar attempt for tree-sitter",
"repository": "https://github.com/UserNobody14/tree-sitter-dart", "repository": "https://github.com/UserNobody14/tree-sitter-dart",
"license": "ISC", "license": "ISC",
"main": "bindings/node", "main": "bindings/node",
"types": "bindings/node", "types": "bindings/node",
"_vendoredBy": "gitnexus — upstream generated src/ and bindings/node/binding.cc copied byte-for-byte from https://github.com/UserNobody14/tree-sitter-dart@be07cf7118d3dba06236a3f19541685a68209934. GitNexus keeps its synchronous CommonJS loader and hardened binding.gyp. Prebuilds are rebuilt from these sources by build-tree-sitter-prebuilds.yml. Do not edit generated C by hand.", "_vendoredBy": "gitnexus - re-vendored from UserNobody14/tree-sitter-dart@0038280b774b65c1b89ba7fec50624d8baed9fe1 by grammar-update-monitor on ABI 15. Source-build inputs (parser.c/scanner.c/src/) refreshed; the GitNexus-hardened binding.gyp + synchronous loader + vendor README + prebuilds are preserved (prebuilds are rebuilt by build-tree-sitter-prebuilds.yml on this version change). No scripts/dependencies here (#836/#1728).",
"peerDependencies": { "peerDependencies": {
"tree-sitter": "0.25.1" "tree-sitter": "0.25.1"
}, },
@ -15,5 +15,5 @@
"optional": true "optional": true
} }
}, },
"_upstreamCommit": "be07cf7118d3dba06236a3f19541685a68209934" "_upstreamCommit": "0038280b774b65c1b89ba7fec50624d8baed9fe1"
} }

View file

@ -1,6 +1,6 @@
423e36a7cc1e3186d5b5d34435916c9746883d3745de33be21ec0c9db19a0d0c ./darwin-arm64/tree-sitter-dart.node 27da0743f90e98bd2117164fffb89d30975d665c6c8c09f0646964e2b5842331 ./darwin-arm64/tree-sitter-dart.node
da526be2e8c6caf0d6b5421c33a59ff0ffcba3609172bd0399bfe98abd1550f2 ./darwin-x64/tree-sitter-dart.node 8c22efae548b85fa3569af4917eb35165436968abbd0007b2ee32e7afaeca85d ./darwin-x64/tree-sitter-dart.node
18ee4afbaaa883416ee671c551ba3c69b0dc7ff0bccc42463c9d8e32eea2e704 ./linux-arm64/tree-sitter-dart.node 6126179aa1a164e940b9d960a1b767a4d7a56b0ea00baaf59bca03044463f691 ./linux-arm64/tree-sitter-dart.node
209d3949337ebc59b0f31b19333345e1a45c800f81808cf9f811a3b469166549 ./linux-x64/tree-sitter-dart.node 88e0af5d4f65e48ac57922168504b2a7604e2b19dad5272c4d8a611e0f8db62f ./linux-x64/tree-sitter-dart.node
535954d7ffe0b436551c9837be5cf5cf5d7b9cdb6a0d68dd9def2d154164cb51 ./win32-arm64/tree-sitter-dart.node cb4d1a0d1eceec1632f1333bbe5358319f6fdcfe1b3b8098166c2c6dab93e035 ./win32-arm64/tree-sitter-dart.node
0c3790d0d9e440c11ea90d9a48b308cef4fe0e1e1865243131e4c3e7dfe7e2ff ./win32-x64/tree-sitter-dart.node 3b7aba0e431ceef9ecbb8ce0b467efd5958d5e150862ea7fdd385684959d9fae ./win32-x64/tree-sitter-dart.node

View file

@ -2168,6 +2168,16 @@
} }
] ]
}, },
"primary_constructor": {
"multiple": false,
"required": false,
"types": [
{
"type": "primary_constructor",
"named": true
}
]
},
"superclass": { "superclass": {
"multiple": false, "multiple": false,
"required": false, "required": false,
@ -2205,6 +2215,10 @@
"type": "base", "type": "base",
"named": true "named": true
}, },
{
"type": "const_builtin",
"named": true
},
{ {
"type": "interface", "type": "interface",
"named": true "named": true
@ -2755,7 +2769,26 @@
{ {
"type": "constant_constructor_signature", "type": "constant_constructor_signature",
"named": true, "named": true,
"fields": {}, "fields": {
"name": {
"multiple": true,
"required": false,
"types": [
{
"type": ".",
"named": false
},
{
"type": "identifier",
"named": true
},
{
"type": "new",
"named": false
}
]
}
},
"children": { "children": {
"multiple": true, "multiple": true,
"required": true, "required": true,
@ -2767,10 +2800,6 @@
{ {
"type": "formal_parameter_list", "type": "formal_parameter_list",
"named": true "named": true
},
{
"type": "identifier",
"named": true
} }
] ]
} }
@ -3054,7 +3083,7 @@
"fields": { "fields": {
"name": { "name": {
"multiple": true, "multiple": true,
"required": true, "required": false,
"types": [ "types": [
{ {
"type": ".", "type": ".",
@ -3188,6 +3217,10 @@
"type": "operator_signature", "type": "operator_signature",
"named": true "named": true
}, },
{
"type": "primary_constructor_body_signature",
"named": true
},
{ {
"type": "record_type", "type": "record_type",
"named": true "named": true
@ -3300,7 +3333,7 @@
"fields": {}, "fields": {},
"children": { "children": {
"multiple": true, "multiple": true,
"required": true, "required": false,
"types": [ "types": [
{ {
"type": "annotation", "type": "annotation",
@ -3373,7 +3406,7 @@
"fields": { "fields": {
"body": { "body": {
"multiple": false, "multiple": false,
"required": true, "required": false,
"types": [ "types": [
{ {
"type": "enum_body", "type": "enum_body",
@ -3390,6 +3423,26 @@
"named": true "named": true
} }
] ]
},
"primary_constructor": {
"multiple": false,
"required": false,
"types": [
{
"type": "primary_constructor",
"named": true
}
]
},
"type_parameters": {
"multiple": false,
"required": false,
"types": [
{
"type": "type_parameters",
"named": true
}
]
} }
}, },
"children": { "children": {
@ -3400,6 +3453,10 @@
"type": "annotation", "type": "annotation",
"named": true "named": true
}, },
{
"type": "const_builtin",
"named": true
},
{ {
"type": "interfaces", "type": "interfaces",
"named": true "named": true
@ -3407,10 +3464,6 @@
{ {
"type": "mixins", "type": "mixins",
"named": true "named": true
},
{
"type": "type_parameters",
"named": true
} }
] ]
} }
@ -3731,7 +3784,7 @@
"fields": { "fields": {
"body": { "body": {
"multiple": false, "multiple": false,
"required": true, "required": false,
"types": [ "types": [
{ {
"type": "extension_body", "type": "extension_body",
@ -3815,7 +3868,7 @@
"fields": { "fields": {
"body": { "body": {
"multiple": false, "multiple": false,
"required": true, "required": false,
"types": [ "types": [
{ {
"type": "class_body", "type": "class_body",
@ -8353,6 +8406,10 @@
"type": "operator_signature", "type": "operator_signature",
"named": true "named": true
}, },
{
"type": "primary_constructor_body_signature",
"named": true
},
{ {
"type": "setter_signature", "type": "setter_signature",
"named": true "named": true
@ -10687,6 +10744,55 @@
] ]
} }
}, },
{
"type": "primary_constructor",
"named": true,
"fields": {
"name": {
"multiple": false,
"required": false,
"types": [
{
"type": "identifier",
"named": true
},
{
"type": "new",
"named": false
}
]
},
"parameters": {
"multiple": false,
"required": true,
"types": [
{
"type": "formal_parameter_list",
"named": true
}
]
}
}
},
{
"type": "primary_constructor_body_signature",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "initializers",
"named": true
},
{
"type": "this",
"named": true
}
]
}
},
{ {
"type": "program", "type": "program",
"named": true, "named": true,
@ -11644,7 +11750,7 @@
"fields": { "fields": {
"name": { "name": {
"multiple": false, "multiple": false,
"required": true, "required": false,
"types": [ "types": [
{ {
"type": "identifier", "type": "identifier",
@ -11652,9 +11758,19 @@
} }
] ]
}, },
"parameters": {
"multiple": false,
"required": false,
"types": [
{
"type": "formal_parameter_list",
"named": true
}
]
},
"type": { "type": {
"multiple": true, "multiple": true,
"required": true, "required": false,
"types": [ "types": [
{ {
"type": ".", "type": ".",
@ -11699,6 +11815,10 @@
"type": "annotation", "type": "annotation",
"named": true "named": true
}, },
{
"type": "final_builtin",
"named": true
},
{ {
"type": "identifier", "type": "identifier",
"named": true "named": true

File diff suppressed because it is too large Load diff