Skip to content

dart: try/finally keywords misdetected as zero-arg function declarations #1622

Closed

Description

@squid-protocol

Summary

Dart's try and finally keywords at line start are misdetected as phantom zero-arg function declarations because the func_start regex's negative-lookahead exclusions (at alternatives A/B/C boundaries) exclude class|mixin|enum|extension|typedef|if|for|while|switch|catch|case|when|assert|return|throw|new|var|final|const — but never try or finally. So try { / finally { matches as a function literally named "try"/"finally".

Confirmed repro

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("    try {")
<re.Match object; span=(0, 9), match='    try'>  # captures group 3 = 'try'
>>> rule.search("    finally {")
<re.Match object; span=(0, 13), match='    finally'>  # captures group 3 = 'finally'

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

  • language-crucible/data/dart/flutter/*.dart corpus: 38 rows in function_data literally named "try"
  • These account for ~9% of dart's remaining func_start false-positive rate
  • The same gap applies to finally (though this corpus has zero finally-named false positives)

Fix direction

Add try and finally to the negative-lookahead exclusion lists in dart's func_start regex (all 3 occurrences at alternatives A/B/C boundaries), matching the existing catch handling immediately adjacent to them in the pattern.

Labels

bug, core-engine

File location

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

Activity

  1. added
    bug
    core-engine
    on Aug 14, 2026
  2. added this to the v2.4.8 milestone on Aug 16, 2026
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