fix(testing): dart named/factory constructor names no longer truncated - #1589
Merged
Merged
Conversation
squid-protocol
enabled auto-merge (squash)
August 14, 2026 14:42
_get_node_name's generic "name" field fast path intercepted dart's
constructor_signature nodes before the dedicated dart branch further
down could run, since tree-sitter-dart tags a named constructor's
class-name identifier, ".", AND constructor-name identifier all with
the SAME field name "name" -- child_by_field_name only returns the
FIRST match, silently truncating e.g. "TextEditingController.fromValue"
down to just "TextEditingController". That collided with the class's
own default constructor (both resolved to the bare class name), making
every correctly-detected named/factory constructor look like a false
"extra" with no real counterpart to pair against.
Moved the dart constructor check to the top of _get_node_name so it
intercepts before the generic fast path, and fixed it to scan children
by TYPE ("identifier") rather than by field name: constructor_signature
tags all its identifiers with field "name", but
constant_constructor_signature/factory_constructor_signature tag none
of their children with any field name at all (confirmed directly) --
a field-based version silently returned nothing for those two.
dart: found_functions 1100 -> 1108, extra_functions 426 -> 418.
Fixes #1569
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
squid-protocol
force-pushed
the
fix/1569-dart-constructor-name-truncation
branch
from
August 14, 2026 14:46
5fd5e94 to
43b1d14
Compare
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_node_name's generic"name"field fast path intercepted dart'sconstructor_signaturenodes before the dedicated (but unreachable) dart branch further down could run. tree-sitter-dart tags a named constructor's class-name identifier,., AND constructor-name identifier all with the SAME field name"name"—child_by_field_nameonly returns the FIRST match, silently truncating e.g."TextEditingController.fromValue"down to just"TextEditingController". That collided with the class's own default constructor, making every correctly-detected named/factory constructor look like a false "extra" with no real ground-truth counterpart to pair against._get_node_name, and fixed it to scan children by TYPE ("identifier") rather than by field name:constructor_signaturetags all its identifiers with field"name", butconstant_constructor_signature/factory_constructor_signaturetag none of their children with any field name at all (confirmed directly against real parse trees) — a field-based version silently returned nothing for those two node types.found_functions1100 → 1108,extra_functions426 → 418.Fixes #1569
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--summary-tableregenerated (dart row only)🤖 Generated with Claude Code