Skip to content

Commit 9ce6368

Browse files
committed
fix(wasm): resolve E0308 so bet-wasm (and the whole Rust workspace) builds
The default-return scaffold's `match ret_ty` had inconsistent arm types: the I32 arm was a statement block (`()`), while I64/F32/F64 were bare `func.instruction(...)` expressions (`&mut Function`). The match is purely side-effecting (emits a default-return instruction; its value is unused), so all arms are now `()` statement blocks. Verified: `cargo test -p bet-wasm` → 8 passed; `cargo build --workspace` → exit 0 (every Rust crate now compiles). README status refreshed (wasm: paused → builds; still scaffolding pending AST lowering). Scope: this is the build-unblock only. Raising bet-eval/bet-codegen toward parity with the authoritative Racket interpreter remains follow-on work. https://claude.ai/code/session_01QGi8GND5yNWgDyfReVEPYs
1 parent da8a232 commit 9ce6368

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

README.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ for the mechanised fragment.
9696
* `compiler/bet-core/` — core type definitions (incl. `Echo T`, `EchoR T`)
9797
* `compiler/bet-check/` — Hindley-Milner type checker + unifier (27 tests pass)
9898
* `compiler/bet-parse/` — LALRPOP-based surface parser
99-
* `compiler/bet-wasm/` — WASM backend (**paused**, pre-existing build issue)
99+
* `compiler/bet-wasm/` — WASM backend (builds; scaffolding — emits default-return stubs pending AST lowering)
100100

101101
Rust is the compiler tooling layer. Core semantics remain in Racket.
102102

@@ -453,7 +453,7 @@ BetLang is built on three principles:
453453
| VS Code extension | 🟡 In progress | AffineScript source (replaces ReScript)
454454
| Web Playground (ui/) | ✅ Available | Quantum-inspired features
455455
| FFI (Zig) | 🟡 Experimental | playground/ffi/zig/
456-
| WASM backend | ⏸️ Paused | Pre-existing build issue in bet-wasm
456+
| WASM backend | 🟡 Builds (scaffolding) | E0308 fixed; emits default-return stubs pending AST lowering
457457
|===
458458

459459
---

compiler/bet-wasm/src/lib.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,9 +552,15 @@ impl WasmBackend {
552552
func.instruction(&Instruction::I32Const(0));
553553
}
554554
}
555-
WasmType::I64 => func.instruction(&Instruction::I64Const(0)),
556-
WasmType::F32 => func.instruction(&Instruction::F32Const(0.0)),
557-
WasmType::F64 => func.instruction(&Instruction::F64Const(0.0)),
555+
WasmType::I64 => {
556+
func.instruction(&Instruction::I64Const(0));
557+
}
558+
WasmType::F32 => {
559+
func.instruction(&Instruction::F32Const(0.0));
560+
}
561+
WasmType::F64 => {
562+
func.instruction(&Instruction::F64Const(0.0));
563+
}
558564
}
559565
}
560566

0 commit comments

Comments
 (0)