Skip to content

fix(testing): dart named/factory constructor names no longer truncated - #1589

Merged
squid-protocol merged 1 commit into
mainfrom
fix/1569-dart-constructor-name-truncation
Aug 14, 2026
Merged

fix(testing): dart named/factory constructor names no longer truncated#1589
squid-protocol merged 1 commit into
mainfrom
fix/1569-dart-constructor-name-truncation

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

  • _get_node_name's generic "name" field fast path intercepted dart's constructor_signature nodes 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_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, making every correctly-detected named/factory constructor look like a false "extra" with no real ground-truth counterpart to pair against.
  • Moved the dart constructor check to the top of _get_node_name, 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 against real parse trees) — a field-based version silently returned nothing for those two node types.
  • dart: found_functions 1100 → 1108, extra_functions 426 → 418.

Fixes #1569

Test plan

  • Verified all 5 constructor shapes (default, named, const-named, factory-named, and the collision case) directly against tree_sitter_language_pack
  • python tests/tools/tree_sitter_accuracy_audit.py --lang dart — baseline regenerated, numbers above
  • python tests/tools/tree_sitter_accuracy_audit.py --all --ci — all 31 languages pass
  • --summary-table regenerated (dart row only)

🤖 Generated with Claude Code

@squid-protocol
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
squid-protocol force-pushed the fix/1569-dart-constructor-name-truncation branch from 5fd5e94 to 43b1d14 Compare August 14, 2026 14:46
@squid-protocol
squid-protocol merged commit fcf103c into main Aug 14, 2026
27 checks passed
@squid-protocol
squid-protocol deleted the fix/1569-dart-constructor-name-truncation branch August 14, 2026 14:47
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

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.

tree_sitter_accuracy_audit: dart named/factory constructor names get truncated to the bare class name, colliding with the default constructor

1 participant