Repository navigation
Add a Scala.js example to the wasm corpus and fix none subtyping - #314
Merged
Merged
Conversation
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.
Scala.js 1.23.0 can emit a bare Wasm module (
ModuleKind.WasmModule), with no JS glue and no WASI. This adds a hello world built that way to the corpus and runs it inMachinesTest, interpreted and compiled.The module needs GC, exceptions and tail calls.
System.outdoesn't link in this mode, so the program declaresenv.print(Array[Byte])with@WasmImport, and the test's host function reads the bytes from theWasmArrayit receives.mainruns as the start function.Validating the module exposed a bug: the
nonecase ofheapTypeSubtypehad its arguments swapped, checkingany <: htinstead ofht <: any. Soref.null nonewas rejected wherevereq,i31,structorarraywas expected; Scala.js hits this when it fillsstructreffields with nulls. It now follows the spec rule:none <: htifht <: any.Other changes:
compile.shhas ascalajstarget, and the corpus image installs sbt.WasmWriterTestskips the module: the Scala.js linker pads section sizes to 4 bytes, like the Go and Kotlin modules that are already skipped.Testing:
none.watcorpus module withNoneTest, which runs every export on the interpreter and the compiler. It fails on main.MachinesTest.shouldRunScalaJsWasmInterpretedandshouldRunScalaJsWasmCompiled.wasm,runtime,compiler,wasi,compiler-tests,machine-testsandruntime-testspass locally..wasm.