Merged
Conversation
binop except assign and conditionals
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This pull request implements comprehensive binary and unary expression lowering for the WASM code generator, enabling the Inference compiler to translate arithmetic, comparison, logical, bitwise, and shift operations to WebAssembly bytecode. The implementation correctly handles sign-sensitive instruction selection for both 32-bit and 64-bit integer types.
Changes:
- Added binary expression lowering with correct dispatch based on operand types (signed/unsigned, i32/i64) for all operators except
**(power) and assignments - Added unary expression lowering for negation (
-), logical NOT (!), and bitwise NOT (~) using WASM idioms - Added parenthesized expression support (transparent wrapper)
- Extended variable definition initializers to accept any value-producing expression
- Added 11 comprehensive test suites with 2,300+ lines of test code covering edge cases, type combinations, and compound expressions
Reviewed changes
Copilot reviewed 36 out of 47 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
core/wasm-codegen/src/compiler.rs |
Core implementation: binary/unary expression lowering, type helpers, instruction dispatch logic |
core/wasm-to-v/src/wasm_parser.rs |
Updated example to use codegen_output.wasm() accessor |
core/wasm-to-v/src/lib.rs |
Updated custom instruction encoding table |
core/wasm-to-v/README.md |
Updated custom instruction encoding table |
core/type-checker/src/typed_context.rs |
Added documentation for TypedContext and MissingExpressionType |
core/type-checker/src/type_info.rs |
Added documentation for TypeInfoKind, TypeInfo, and helper methods |
core/type-checker/src/lib.rs |
Added documentation for TypeCheckerBuilder::new |
core/cli/src/main.rs |
Updated non-deterministic instructions list in doc comment |
core/cli/README.md |
Updated codegen completion message |
core/ast/src/arena.rs |
Added documentation for arena query methods |
core/ast/docs/nodes.md |
Added codegen notes for BinaryExpression and PrefixUnaryExpression |
CHANGELOG.md |
Comprehensive entry documenting all new binary/unary operator support |
tests/src/codegen/wasm/mod.rs |
Registered 9 new test modules |
tests/src/codegen/wasm/base.rs |
Added binary_ops_test with comprehensive execution tests |
tests/src/codegen/wasm/validation.rs |
Added 14 validation tests for binary/unary/parenthesized expressions |
tests/src/codegen/wasm/binops_*.rs (9 files) |
Test implementations for unary combos, u32, sub-i32, shift edge, paren, i64 cmp/bitwise/arith, compound, and bool operations |
tests/test_data/codegen/wasm/**/*.inf (11 files) |
Source test fixtures covering all operator combinations and edge cases |
tests/test_data/codegen/wasm/**/*.wasm (11 files) |
Golden WASM bytecode files for equivalence testing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Closes #140