Repository navigation
fix(csharp): make Invocation Shield terminator scan paren/bracket-depth aware - #1454
Merged
Merged
Conversation
…th aware (#1428) The `;` vs `{`/`=>` terminator shield (added for #789) did three independent `.find()` calls and picked whichever came first by raw string index, with no awareness of paren/bracket nesting. A lambda argument's `=>` inside a multi-line call's unclosed parens (e.g. `.Select(m => m.Name)`) could arrive before the statement's real terminating `;`, so the shield misread an ordinary statement as an expression-bodied member. Replaced the three .find() calls with a single forward scan that tracks ()/[] depth and only treats {, ;, or => as a real terminator at depth 0 -- same idiom as rust/zig/dart's existing depth-aware terminator scans. extra_functions 309->308 (SourceAssembly.Modules.Skip confirmed gone from the false-positive sample). Co-Authored-By: Claude Sonnet 5 <[email protected]> Co-Authored-By: Gemini 3.1 Pro <[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 #1428 (follow-up to #1418). csharp's
;vs{/=>terminator shield indetector.pydidthree independent
.find()calls and picked whichever came first by raw string index, with noawareness of paren/bracket nesting -- a lambda argument's
=>inside a multi-line call's unclosedparens could arrive before the statement's real terminating
;, misreporting the call's ownidentifier as a function.
Fix
Replaced the three
.find()calls with a single forward scan tracking()/[]depth, onlytreating
{,;, or=>as a real terminator at depth 0 -- same idiom as rust/zig/dart'sexisting depth-aware terminator scans. Gated entirely to
lang_id == "csharp".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
extra_functions309 -> 308 --SourceAssembly.Modules.Skip(the issue's repro) confirmed gonefrom the false-positive sample; no other metric moved.
Test plan
tests/extraction/languages/test_csharp.py/test_csharp_strict.py-- 159 passed (newregression test instantiates
StructuralExtractordirectly on the repro snippet)tree_sitter_accuracy_audit.py --lang csharp --regenerate+--summary-tabletree_sitter_accuracy_audit.py --all --ci-- all 31 languages cleancrucible_check.py --mode both-- both golden masters blessed (expected small drift),re-verified clean after
audit_check.py --ci --regenerate-- ruff/mypy/dead-key/ast-accuracy all clean🤖 Generated with Claude Code + Gemini (Antigravity CLI)