Running moon test on a clean checkout of main (or any branch — reproduces independently of source changes) fails on the wasm-gc backend during execution of the bool blackbox test driver:
CompileError: WebAssembly.Module(): Compiling function #248:"_M0MPC15array13ReadOnlyArray2atGjE" failed: array.get: Immediate array type 71 has packed type i8. Use array.get_s or array.get_u instead. @+38042
Error: Failed to run the test: /Users/dii/git/core/_build/wasm-gc/debug/test/bool/bool.blackbox_test.wasm
The test executable exited with exit status: 1
The mangled symbol _M0MPC15array13ReadOnlyArray2atGjE resolves to ReadOnlyArray::at (builtin/readonlyarray.mbt:25-41), which delegates to FixedArray::at. The emitted wasm uses the unsigned array.get opcode against an array type whose element is declared as packed i8, which the wasm-gc spec only allows via array.get_s / array.get_u. Node's V8 engine therefore rejects the module at instantiation.
The compile-time output is fine; the failure happens when V8 validates the module, so the problem is in moonc's wasm-gc codegen for ReadOnlyArray[T] instantiated at a type whose backing FixedArray uses a packed representation.
Reproduction
git clone git@github.com:moonbitlang/core.git
cd core
moon test # fails
moon test -p moonbitlang/core/bool # smaller repro
moon test --target js # passes (6367 tests)
moon test --target native # passes (6321 tests)
Environment
- macOS (Darwin 25.4.0, arm64)
moon 0.1.20260429 (26f35db 2026-04-29)
moonc v0.9.1+dd1e997c9-nightly (2026-04-30)
moonrun 0.1.20260429
- Node.js v25.8.2 (Homebrew)
Notes
- JS and native backends are unaffected.
- CI presumably uses an older Node.js (or a moonrun that bundles its own runtime), since the wasm-gc job passes there. This may be a regression triggered by stricter validation in newer V8 versions, or by recent codegen changes for
ReadOnlyArray / packed FixedArray.
Originally surfaced while validating an unrelated PR (#3505); filing here so it can be tracked independently.
Running
moon teston a clean checkout ofmain(or any branch — reproduces independently of source changes) fails on the wasm-gc backend during execution of theboolblackbox test driver:The mangled symbol
_M0MPC15array13ReadOnlyArray2atGjEresolves toReadOnlyArray::at(builtin/readonlyarray.mbt:25-41), which delegates toFixedArray::at. The emitted wasm uses the unsignedarray.getopcode against an array type whose element is declared as packedi8, which the wasm-gc spec only allows viaarray.get_s/array.get_u. Node's V8 engine therefore rejects the module at instantiation.The compile-time output is fine; the failure happens when V8 validates the module, so the problem is in moonc's wasm-gc codegen for
ReadOnlyArray[T]instantiated at a type whose backing FixedArray uses a packed representation.Reproduction
Environment
moon 0.1.20260429 (26f35db 2026-04-29)moonc v0.9.1+dd1e997c9-nightly (2026-04-30)moonrun 0.1.20260429Notes
ReadOnlyArray/ packedFixedArray.Originally surfaced while validating an unrelated PR (#3505); filing here so it can be tracked independently.