WebAssembly / reference-types

Proposal for adding basic reference types (anyref)
https://webassembly.github.io/reference-types/
Other
162 stars 40 forks source link

Missing validation step for ref.null #110

Closed wingo closed 4 years ago

wingo commented 4 years ago

A colleague noticed that on https://webassembly.github.io/reference-types/core/valid/instructions.html#xref-syntax-instructions-syntax-instr-ref-mathsf-ref-null-t, it doesn't specify that t should be a reference type. Does another part of the document specify this?

binji commented 4 years ago

cc @rossberg

My guess is that this is omitted because it can never actually be a validation failure -- the t in ref.null t will always be a reference type, because that is required by the text/binary readers: see https://webassembly.github.io/reference-types/core/binary/instructions.html#reference-instructions and https://webassembly.github.io/reference-types/core/text/instructions.html#reference-instructions

rossberg commented 4 years ago

More specifically, the abstract syntax makes this a reference type by construction, see (and that matches both the binary and the text format):

https://webassembly.github.io/reference-types/core/syntax/instructions.html#syntax-instr-ref

wingo commented 4 years ago

OK makes sense. Thanks for the info!