feat: add C# 12 collection expression support#409
feat: add C# 12 collection expression support#409slang25 wants to merge 1 commit intotree-sitter:masterfrom
Conversation
3fb31be to
110f489
Compare
Implement grammar rules for collection expressions ([e1, e2, ..e3]) and spread elements (..). Resolves syntax conflicts with list patterns and range expressions through precedence rules and GLR conflict declarations. All 164 tests pass, including 9 new collection expression test cases covering empty, simple, nested, and spread scenarios. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
110f489 to
a9bb310
Compare
|
I independently worked on the same feature in #414 and validated this PR against the pathological case from my issue comment: Confirmed this PR fully fixes it — all methods parse correctly with zero ERROR nodes. Ternary + collection ( The Note: the CI parse-examples step will likely fail due to pre-existing issues — PowerToys and NUnit repos have been updated since the last master CI run, introducing files at new paths that aren't in the exclude list yet. See the exclude list update in my (now-closed) #414 for the specific files that need adding. |
Summary
[e1, e2, ..e3]) and spread elements (..)element_binding_expressionhandling to initializer expressions to preserve dictionary/indexer initialization syntaxTest Coverage
Collection expressions tested for: empty literals, simple elements, spread operators, trailing commas, nested collections, method calls in spreads, use as arguments, and conditional spreads with parentheses.
🤖 Generated with Claude Code