Skip to content

dart: bodyless zero-prefix constructors not found (ClassName(params); with no braces) #1625

Closed

Description

@squid-protocol

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 constructor

Corpus impact (confirmed via tests/tools/tree_sitter_accuracy_audit.py --lang dart):

Distinction from related issues

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

Labels

bug, core-engine

File location

gitgalaxy/standards/language_standards.py line ~9322-9345 (dart func_start regex, alternative C lookahead)

Activity

  1. added
    bug
    core-engine
    on Aug 14, 2026
  2. squid-protocol commented on Aug 15, 2026

    @squid-protocol
    OwnerAuthor

    @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.

  3. added this to the v2.4.8 milestone on Aug 16, 2026
  4. added a commit that references this issue on Aug 17, 2026
    b6ab733
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-engine

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions