WebAssembly / gc

Branch of the spec repo scoped to discussion of GC integration in WebAssembly
https://webassembly.github.io/gc/
Other
987 stars 71 forks source link

`ToJSValue` missing a case for subtypes of anyref #494

Closed tlively closed 9 months ago

tlively commented 9 months ago

The ToJSValue algorithm in the JS spec looks like it is missing a case for converting subtypes of anyref to JS values. It should first convert them to externref, then use the existing logic for retrieving externref values.

rossberg commented 9 months ago

Hm, I don't see it. Can you give an example of a case that would go wrong?

This algorithm does not care about types, it solely dispatches on the shape of values and it handles all shapes currently possible in Wasm. That dispatch is (and should be) completely agnostic to what types those values were viewed at on the Wasm side – types aren't needed here because there is nothing to check in the Wasm→JS direction.

tlively commented 9 months ago

Indeed, not sure what I was looking at last week. Sorry for the noise!