Skip to content

Conversation

@varndellwagglebee
Copy link
Contributor

Description

Target Frameworks .NET 8, 9, and 10

Checklist

  • [X ] I have run the existing tests and they pass
  • [X ] I have run the existing benchmarks and verified performance has not decreased
  • I have added new tests that prove my change is effective or that my feature works
  • I have added the necessary documentation (if applicable)

HDG520 and others added 7 commits January 18, 2026 19:19
* Fix: Support explicit jagged array syntax (e.g., `new int[][]`)

Previously, the parser could not correctly handle explicit jagged array definitions. It ignored rank specifiers after the type name (e.g., the second `[]` in `int[][]`), causing parsing failures or incorrect type inference.

Changes:
- Added logic to parse optional trailing rank specifiers (consecutive `[]`) in `NewParser`.
- Refactored parsing terms to use `Terms.Char` for starting tokens instead of `XsParser.*` definitions. The `XsParser` definitions include `.ElseError()`, which prevented `ZeroOrMany` and `OneOf` combinators from backtracking or terminating loops correctly (e.g., distinguishing between a new rank `[` and the start of an initializer `{`).
- Updated `ConstructorType.ArrayInit` logic to allow assignment if the explicit jagged array type is compatible with the inferred element type.
- Added unit test `Compile_ShouldSucceed_WithExplicitJaggedArraySyntax` to verify support for `new int[][]`.

* Update XsParserTests.New.cs

remove local comments
@varndellwagglebee varndellwagglebee merged commit 8036702 into main Jan 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants