fix(dart): anchor the args span at the name, not a leading @annotation (#2341) - #2347
Merged
Merged
Conversation
#2341) dart's `func_start` match spans any leading `@annotation(...)` prefix and the return-type prefix, so `start_idx` (the block start / args-span start) can land on an annotation. When that annotation's argument list is multi-line and carries a top-level comma -- `@Deprecated('Use x. ' 'Deprecated after v3.3.',)` is the corpus shape -- its own `(...)` is the first paren the args counter finds, and the declaration's real parameter list is never measured (`ToolbarOptions` const ctor read 0 args, several deprecated getters read 1). Fix: for dart, every args-span computation anchors at `match.start(match. lastindex)` -- the name capture -- instead of `start_idx`. Same `match.lastindex` name-anchor the typescript/javascript branch of `_slice_by_braces` already uses. `start_idx` still bounds the block itself (line numbers, body slice); only the parameter-count slice moves. This closes out the `dart/function/args/agree[none]_vs[gitgalaxy,tree_sitter]` shape entirely: **0 remaining args mismatches** across the 7-file Flutter corpus (was 205 before #2309, 106 after #2335, 6 after #2342), dart args accuracy 99.65% -> **100.0%** (`args_exact_match` 1733 -> 1739 / 1739). Regenerated: both golden masters (16 diffs, all dart -- arg counts + downstream ripple, 0 non-dart content change); `tree_sitter_accuracy_baseline_dart.json`. No summary-table or javascript-baseline change. Verification: test_dart.py (+ new annotation-prefix slicer case) + tests/ extraction (6236) green; ruff/mypy/dead-key/ast-accuracy clean; crucible_check both modes PASS; tree_sitter_accuracy_audit --all --ci green. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2341. Closes out the dart tri-comparison args exploration.
Bug
dart's
func_startmatch spans any leading@annotation(...)prefix, sostart_idx— which anchors both the block and the args-signature slice — can land on the annotation. When the annotation's argument list is multi-line with a top-level comma (@Deprecated('Use x. ' 'Deprecated after v3.3.',), the Flutter corpus shape), its parens are the first the args counter finds — the declaration's real parameter list is never measured.Result:
const ToolbarOptions({...})read 0 args, and several@Deprecated-annotated getters read 1.Fix
For dart, every args-span computation anchors at
match.start(match.lastindex)(the name capture) instead ofstart_idx— the samematch.lastindexname-anchor the typescript/javascript branch of_slice_by_bracesalready uses.start_idxstill bounds the block itself (line numbers, body slice); only the parameter-count slice moves.Result — dart args shape eliminated
args_exact_match1739/1739)GitGalaxy and tree-sitter now agree on the parameter count of every comparable function in the dart corpus. The
dart/function/args/agree[none]_vs[gitgalaxy,tree_sitter]ledger entry will gostill_reproduces: falseon the next companion regen.Regenerated
tree_sitter_accuracy_baseline_dart.json—args_exact_match1733 → 1739Verification
test_dart.py(+ new annotation-prefix slicer case) +tests/extraction(6236) — greencrucible_check.py— PASS both modestree_sitter_accuracy_audit --all --ci— green🤖 Generated with Claude Code