Repository navigation
Description
Summary
Dart allows a constructor with an empty/trivial body to be written with NO braces at all — just ClassName(params); ending directly in a semicolon (legal and common, e.g., when the constructor only does implicit field-parameter assignment via this.x params). The func_start regex's zero-prefix alternative (alt C) requires reaching a real {/=> — per the regex's own inline comment, this was a deliberate choice based on the assumption that "dart's zero-prefix valid cases are all constructors that always have bodies anyway" — but that assumption is false.
Confirmed repro
Real corpus example: language-crucible/data/dart/flutter/editable_text.dart:6653
class _CopySelectionAction extends ContextAction<CopySelectionTextIntent> {
_CopySelectionAction(this.state);
...
}Direct regex test (from activated venv with gitgalaxy installed):
>>> from gitgalaxy.standards.language_standards import LANGUAGE_DEFINITIONS
>>> rule = LANGUAGE_DEFINITIONS["dart"]["rules"]["func_start"]
>>> rule.search(" _CopySelectionAction(this.state);")
None # no match at all -- GitGalaxy never sees this constructorCorpus impact (confirmed via tests/tools/tree_sitter_accuracy_audit.py --lang dart):
language-crucible/data/dart/flutter/*.dartcorpus: missing constructors include_CopySelectionAction,_DeleteTextAction,_SelectAllAction,_PasteSelectionAction,_UpdateTextSelectionAction,_EditableTextTapOutsideAction, and several more in this exact file alone- All have the bodyless-constructor (
ClassName(params);) shape, all currently invisible to GitGalaxy - After fixing dart func_start: 4 distinct false-positive shapes remain after #1477's ground-truth fix (const ctors, colon-init-no-body ctors, multi-line class headers, multi-line bare calls) #1479's ground-truth audit-tool gaps, this became visible as a recall gap (reduction from 94.5% to 76.7%)
Distinction from related issues
- dart func_start: 4 distinct false-positive shapes remain after #1477's ground-truth fix (const ctors, colon-init-no-body ctors, multi-line class headers, multi-line bare calls) #1479 Bug 2 covers constructors with an initializer list and no braced body:
ClassName(this.x) : super.init();(has a:, then;) - dart func_start: constructors with very long (>~2000 char) parameter lists still not found (e.g. ThemeData.raw) #1493 covers constructors with pathologically long (>~2000 char) parameter lists failing due to search-bound limits
- This issue covers constructors with NO body-terminator at all:
ClassName(params);(direct;, no{and no:)
Fix direction
Dart's zero-prefix alt C (the (?:^|\s)([a-z_][a-zA-Z0-9_]*)\s*\( shape) needs a case for "closes its parameter list, then goes straight to ;" as a valid (bodyless) constructor form — but only for the zero-prefix shape (a name matching the enclosing class name or ClassName.namedConstructor pattern), not opened up generally (that would reintroduce false-positive risk from issues #1622/#1623).
Related issues
- dart func_start: 4 distinct false-positive shapes remain after #1477's ground-truth fix (const ctors, colon-init-no-body ctors, multi-line class headers, multi-line bare calls) #1479: dart func_start false positives (colon-initializer no-body variant, distinct but related)
- dart func_start: constructors with very long (>~2000 char) parameter lists still not found (e.g. ThemeData.raw) #1493: dart constructors with very long parameter lists (distinct search-limit issue)
Labels
bug, core-engine
File location
gitgalaxy/standards/language_standards.py line ~9322-9345 (dart func_start regex, alternative C lookahead)
Activity
squid-protocol commentedon Aug 15, 2026
@uuzzrm thanks for your PRs today and sorry we stepped on each others toes for two of our PRs, mine were further ahead in the CI pipeline process when yours arrived so I politely closed them. Happy to have you take this one if you'd like.
Fix #1625: Support Dart bodyless zero-prefix constructors (#1799)