Repository navigation
fix(csharp): extend func_start Invocation Shield to cover zero-prefix bare call statements - #1429
Merged
Merged
Conversation
… bare call statements (#1418) Split func_start into three alternatives (mirroring dart #1221 / rust #1319): branch A requires >=1 modifier (tolerates a bare ';' -- real abstract/interface declarations), branch B requires a return-type-shaped prefix with no modifier (same tolerance, covers interface methods like `void Foo(int x);`), and the new branch C is the true zero-prefix path -- it now requires the signature to actually open a block (`{`/`=>`), closing the gap where an ordinary multi-line call statement with no modifier/return-type prefix (e.g. `AccumulateExplicitInterfaceName(ref a, ref b);`) matched as if it were a function definition. Confirmed via 3 independent checks (regex finditer, isolated file scan, direct corpus SQL query): the flagship repro (roslyn/LanguageParser.cs's AccumulateExplicitInterfaceName, previously matching 4x) now matches exactly once, at its real definition. Co-Authored-By: Claude Sonnet 5 <[email protected]> Co-Authored-By: Gemini 3.1 Pro <[email protected]>
…lden masters extra_functions 329->309 in the per-name accuracy audit (which dedupes by name); the real-world raw signature-count impact is much larger -- e.g. roslyn/LanguageParser.cs's own Function/Method Declarations count drops 1277->677 in this file alone, since the fix eliminates hundreds of duplicate phantom "function" rows previously created by unshielded bare call statements, not just the flagship named repro. Cascading drift in the global PageRank/spatial-coordinate stats across the rest of the corpus is the expected downstream ripple of that. 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
Fixes #1418. csharp
func_start's Invocation Shield allowed a multi-line bare call statement(no modifier, no return type, ending in a bare
;) to match as if it were a function definition-- e.g.
AccumulateExplicitInterfaceName(ref explicitInterfaceName, ref separator);, a plain callin
roslyn/LanguageParser.cs, matched 3 extra times beyond the one real definition.Fix
Split
func_startinto three alternatives (mirroring#1221's dart split /#1319's rustgating):
;(real abstract/interface/partialdeclarations legitimately have no body).
bare
;(covers interface methods likevoid Foo(int x);that have a return type but noaccess modifier).
block (
{/=>) -- this is what closes the gap, since an ordinary call statement never has amodifier, return type, or its own block.
Root-caused by Claude, implemented by Gemini (
agy/Antigravity CLI) in an isolated worktree,independently re-verified end-to-end by Claude before push.
Results
Confirmed 3 independent ways (regex
finditer, isolated single-file scan, direct corpus SQLquery): the flagship repro now matches exactly once (the real definition), down from 4.
tests/tools/tree_sitter_accuracy_audit.py --lang csharp(dedupes by name, per its owndocumented scope limitation):
The real-world raw-count impact is much larger than the per-name metric shows: e.g.
roslyn/LanguageParser.cs's ownFunction/Method Declarationscount (undeduped, from an actualgalaxyscopescan) drops from 1277 to 677 in that one file alone -- the fix eliminates hundredsof duplicate phantom "function" entries from unshielded bare call statements throughout a large
real-world file, not just the one flagship name. This is expected, correct behavior; the golden
masters were regenerated to reflect it.
Incidental findings filed separately (not in this PR's scope)
error in a large corpus file (measurement-tool bug, not a GitGalaxy defect).
detector.py's own;/{/=>terminator shield, fooled by a lambda arrow inside multi-linecall arguments.
Test plan
tests/extraction/languages/test_csharp.py/test_csharp_strict.py-- 158 passed (2 newcases: a bodyless-interface valid case, the exact bare-call repro as an invalid case)
tree_sitter_accuracy_audit.py --lang csharp --regenerate+--summary-tablecrucible_check.py --mode both-- both golden masters blessed (expected drift, see above),re-verified clean after
audit_check.py --ci-- ruff/mypy/dead-key/ast-accuracy all clean, no new findings🤖 Generated with Claude Code + Gemini (Antigravity CLI)