You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed critical bugs in code generation for complex array types (jagged, multi-dimensional,
and mixed arrays) across multiple built-in type generators. The generators were manually
constructing array creation syntax which caused compilation errors for complex array types.
Root cause:
- ArrayGenerator.cs, QueueGenerator.cs, and ArraySegmentGenerator.cs had duplicate logic
for array creation that incorrectly handled complex types like int[][][,] or byte[][,]
- For example: `new byte[][length]` instead of `new byte[length][]`
Solution:
1. Created shared `GetArrayCreationString()` helper method in NinoBuiltInTypeGenerator.cs
that correctly handles all array types by inserting dimension specifier before the
first bracket, accounting for generics
2. Updated ArrayGenerator.cs to use helper for both 1D and multi-dimensional arrays
3. Updated QueueGenerator.cs to use `var` for type inference instead of explicit declaration
4. Updated ArraySegmentGenerator.cs to use the helper method
5. Audited all other generators (Immutable*, LinkedList, PriorityQueue, Stack) - confirmed safe
Testing:
- Added comprehensive tests for Queue/Stack with complex arrays (int[][][,], string[,][][][])
- Added ArraySegment tests with jagged arrays (byte[], int[][], int[][][])
- Added PriorityQueue tests for .NET 6.0+ with:
* Jagged arrays (byte[][], int[][][])
* 2D arrays (int[,])
* 3D arrays (int[,,])
* Mixed jagged/multi-dim (int[][,])
* Mixed multi-dim/jagged (int[,][])
- All 7 test methods (5 original + 2 new) pass across .NET 6.0, 8.0, and netstandard2.1
This eliminates manual array syntax construction across the codebase, preventing future
regressions and ensuring consistent behavior for all complex array types.
Closes#161
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
0 commit comments