fix(testing): dart param count now recurses into optional_formal_parameters - #1592
Merged
squid-protocol merged 1 commit intoAug 14, 2026
Merged
Conversation
…meters
_get_param_count's dart handling only scanned DIRECT children of a
parameter list for "formal_parameter" nodes, but tree-sitter-dart wraps
BOTH optional-positional (`[bool x = true]`) and named (`{required
this.x}`) parameters one level deeper, inside a shared
"optional_formal_parameters" node type -- confirmed identical for both
bracket styles. Since named parameters are the dominant convention in
idiomatic Dart/Flutter (virtually every widget constructor), any
signature using either form measured 0 real params regardless of its
true arity.
Two separate call sites needed the fix: the dart-specific
`function_signature` branch (methods/local functions), and the generic
field-based `counted_types` loop (`constructor_signature`, which --
unlike function_signature -- DOES expose a field-tagged "parameters"
and so takes that path instead).
dart: args_exact_match 871 -> 960 (out of 1108 comparable).
Fixes #1570
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
squid-protocol
deleted the
fix/1570-dart-optional-formal-parameters-count
branch
August 14, 2026 14:50
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.
Summary
_get_param_count's dart handling only scanned DIRECT children of a parameter list for"formal_parameter"nodes, but tree-sitter-dart wraps BOTH optional-positional ([bool x = true]) and named ({required this.x}) parameters one level deeper, inside a shared"optional_formal_parameters"node type (confirmed identical for both bracket styles). Since named parameters are the dominant convention in idiomatic Dart/Flutter (virtually every widget constructor), any signature using either form measured 0 real params regardless of its true arity.function_signaturebranch (methods/local functions), and the generic field-basedcounted_typesloop (constructor_signature, which — unlikefunction_signature— DOES expose a field-tagged"parameters"and so takes that path instead).args_exact_match871 → 960 (out of 1108 comparable).Fixes #1570
Test plan
tree_sitter_language_packpython tests/tools/tree_sitter_accuracy_audit.py --lang dart— baseline regenerated, numbers abovepython tests/tools/tree_sitter_accuracy_audit.py --all --ci— all 31 languages pass🤖 Generated with Claude Code