Oliver.O
12/15/2023, 1:06 PMlocal.get of type externref has to be in the same reference type hierarchy as (ref 2204) @+1331845
If my code is at fault, wouldn't the Kotlin compiler be supposed to report an error?
Details in 🧵.Oliver.O
12/15/2023, 1:07 PMfile:.../kotest/kotest-framework/kotest-framework-multiplatform-plugin-gradle/test-project/build/js/packages/test-project-wasm-js-test/kotlin/test-project-wasm-js-test.uninstantiated.mjs:3890
const wasmModule = new WebAssembly.Module(wasmBuffer);
^
CompileError: WebAssembly.Module(): Compiling function #15410:"io.kotest.common.runPromise$lambda.invoke" failed: Invalid types for ref.test: local.get of type externref has to be in the same reference type hierarchy as (ref 2204) @+1331845
at instantiate (file:.../kotest/kotest-framework/kotest-framework-multiplatform-plugin-gradle/test-project/build/js/packages/test-project-wasm-js-test/kotlin/test-project-wasm-js-test.uninstantiated.mjs:3890:28)
at async file:.../kotest/kotest-framework/kotest-framework-multiplatform-plugin-gradle/test-project/build/js/packages/test-project-wasm-js-test/kotlin/test-project-wasm-js-test.mjs:3:17
Node.js v22.0.0-v8-canary20231213fc7703246e
Svyatoslav Kuzmich [JB]
12/15/2023, 1:10 PMOliver.O
12/15/2023, 1:12 PMSvyatoslav Kuzmich [JB]
12/15/2023, 1:14 PMOliver.O
12/15/2023, 1:15 PMOliver.O
12/15/2023, 2:17 PMOliver.O
12/15/2023, 10:04 PMPromise.catch(onRejected: (JsAny) -> S)
invokes its lambda with a JsAny
parameter instead of a Throwable
as in K/JS. The Wasm CompileError seems to be caused by casting that JsAny
to Throwable
, which is required for re-throwing.
Added a simple reproducer to KT-64357. If you have a good idea for a workaround, please let me know so that folks can get a Kotest version with a Wasm target without waiting for compiler fixes.