Repository navigation
Fix dart func_start false positives; dart now beats tree-sitter on Func Precision - #2073
Merged
Merged
Conversation
…hapes Root-caused two false-positive bug classes in dart's func_start regex (zero-prefix branch): Dart 3 switch-expression arms matched as getters (bare `=>` accepted without requiring `get`), and calls with a lambda argument matched as function definitions (naive non-balanced-paren lookahead landed on the lambda's own closing paren instead of the call's). Fixed by gating the bare-arrow alternative behind the existing `get`-group conditional and switching to the same balanced-paren pattern already used elsewhere in this regex, plus a guard against Dart 3's object-destructuring pattern syntax. Full corpus diff (language-crucible/data/dart): 126 false positives removed, 1 genuine recall gain (EditableText's own multi-line constructor). dart now wins Func Precision outright against tree-sitter (1732/1741 vs 1732/1748) -- previously an unvalidated, asterisked disagreement. Validated all three open dart tri-comparison ledger shapes (function existence x2, function args) with concrete evidence; filed gitgalaxy#2071 for the fixed bugs and gitgalaxy#2072 for several smaller, confirmed-but- deferred recall/precision gaps found in the same investigation (a naive fix for one of them -- excluding implements/with/extends from the return-type-prefix vocabulary -- was tested and reverted after it broke generic method type-parameter bounds like `pushNamed<T extends Object?>`). Re-blessed both golden master fixtures (full-precision and zero-dependency) to reflect the corrected dart function/class counts and their expected topological/global-average ripple, verified via crucible_check.py against the full ~80-repo corpus. Co-Authored-By: Claude Sonnet 5 <[email protected]>
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
func_startregex (the zero-prefix branch ofgitgalaxy/standards/language_standards.py):=>lookahead alternative was accepted unconditionally even though every real parameterless=> exprin Dart requires an explicitget. Fixed by gating it behind the sameget-group conditional already used for the bare-;case in this regex.\([^)]*\)) that stopped at the lambda's own closing paren instead of the outer call's. Fixed by switching to the same balanced-paren pattern theargsrule and this regex's own return-type-prefix groups already use, plus a guard rejecting Dart 3's object-destructuring pattern syntax (Pattern(:field) =>).language-crucible/data/dart, 7 Flutter framework files): 126 false-positive matches removed, 1 genuine recall gain (EditableText's own multi-line constructor). Every removed match was manually spot-checked as a real false positive.xfail'd known gap intest_dart.py(a string literal containing text that looks like a function header no longer false-positives, since the balanced-paren tracking correctly treats the embedded()as nested rather than the call's own close).implements/with/extendsfrom the return-type-prefix token vocabulary) that was tried, tested, and reverted after it broke generic method type-parameter bounds likepushNamed<T extends Object?>(...), a much more common legitimate pattern.Closes #2071.
Test plan
tests/extraction/languages/test_dart.py+test_dart_strict.py: 196 passed, 1 skipped, 4 xfailedtests/ruff_audit.py --ci/tests/mypy_audit.py --ci: no new findingscrucible_check.pyagainst the full ~80-repo corpus: all 86 mismatches traced to the dart fix's direct effect or its expected topological/global-average ripple; both golden masters re-blessedtri_comparison_chart.py --all --writeregenerated; diff confirmed scoped to dart only (ledger's 34 newly-discovered unrelated-language entries and 146 unrelated-entry timestamp refreshes from the same full regen were deliberately excluded from this PR to keep it scoped)🤖 Generated with Claude Code