Add comprehensive C# → WAT test suite and fix type mapping bugs in compiler pipeline#44
Draft
Copilot wants to merge 3 commits into
Draft
Add comprehensive C# → WAT test suite and fix type mapping bugs in compiler pipeline#44Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
… and fix MapSet/RuleSet bugs Co-authored-by: TristinPorter <232979486+TristinPorter@users.noreply.github.com>
Co-authored-by: TristinPorter <232979486+TristinPorter@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update Program.cs for testing CSharp to WAT compilation
Add comprehensive C# → WAT test suite and fix type mapping bugs in compiler pipeline
Feb 23, 2026
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.
Testing/Program.cswas missing, leaving the C#→WAT compilation pipeline untested. Running tests exposed several real bugs inMapSet.csandRuleSet.csthat caused incorrect or empty WAT output for typed variables.New:
Testing/Program.cs26 tests covering the full CDTk compilation pipeline (
Tokens+Rules+WASMMapSet):int,long,float,double,bool)if/else,while,for)Bug Fixes
RuleSet.csFloatingPointTypewas a plain string rule without.Returns("type")— unlikeIntegralTypewhich has it — causingfloat/doublekeywords to never be captured in the AST.MapSet.csIntegralType"i32""{type}"long→i64,ulong→i64FloatingPointType"f64""{type}"float→f32LocalVariableType"{type}""{base}"base, nottypeLocalDeclaration"{type} {declarators}""{modifier} {type}"modifieris absent, putting the type intomodifierand declarators intotypeKnown Limitations (documented in tests)
Three CDTk parser-level issues are beyond the scope of these Map fixes and are documented in the relevant tests:
4 * 7) are not emitted into function bodieselseblocks are not wrapped in WAT(else …)due to IfStatement field shifting(call $fn)is not emitted; invocation suffix is parsed but not propagated💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.