Skip to content

fix(dart): anchor the args span at the name, not a leading @annotation (#2341) - #2347

Merged
squid-protocol merged 1 commit into
mainfrom
fix-dart-annotation-prefix-args-2341
Aug 27, 2026
Merged

fix(dart): anchor the args span at the name, not a leading @annotation (#2341)#2347
squid-protocol merged 1 commit into
mainfrom
fix-dart-annotation-prefix-args-2341

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Fixes #2341. Closes out the dart tri-comparison args exploration.

Bug

dart's func_start match spans any leading @annotation(...) prefix, so start_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 of start_idx — the 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.

Result — dart args shape eliminated

shape occurrences dart args accuracy
before #2309 205 ~87%
after #2335 (named param groups) 106 93.9%
after #2342 (const/factory ts, getters, operators) 6 99.65%
this PR 0 100.0% (args_exact_match 1739/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 go still_reproduces: false on the next companion regen.

Regenerated

  • Both golden masters — 16 diffs, all dart (arg counts + downstream ripple), 0 non-dart content change
  • tree_sitter_accuracy_baseline_dart.jsonargs_exact_match 1733 → 1739
  • 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.py — PASS both modes
  • tree_sitter_accuracy_audit --all --ci — green

🤖 Generated with Claude Code

#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>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 6e72ff3 into main Aug 27, 2026
30 checks passed
@squid-protocol
squid-protocol deleted the fix-dart-annotation-prefix-args-2341 branch August 27, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dart func_start consumes a multi-line @Deprecated(...) annotation as a return-type prefix, poisoning args count

1 participant