-
Notifications
You must be signed in to change notification settings - Fork 517
Description
ToJSValue asserts that the input type is neither v128 nor ref.exn exnaddr. To enforce this, there are several places in the spec that say something like "If resultType is v128 or exnref, throw a TypeError." Unfortunately it's not really clear what "exnref" encompasses here.
Specifically, a bug was submitted to SpiderMonkey expecting that the following function would result in unreachable executed instead of TypeError:
(func (result nullexnref)
unreachable
)
There's a case to be made for this, because ToJSValue asserts that no values are of the form ref.exn exnaddr and states that any value of the form ref.null t should be converted to JS null. nullexnref (and technically (ref noexn)) would therefore work fine. But neither Firefox nor Chrome currently allows noexn in parameters or results. (I haven't tested in other engines.)
Should we clarify that "is exnref" means "is a subtype of exnref" or "is a reference type in the exn hierarchy" or something to that effect? It doesn't seem worth it to support nullexnref but not exnref, especially when major engines already consider this an error.