wabt icon indicating copy to clipboard operation
wabt copied to clipboard

Incorrect type for ref.func when function references are enabled

Open 14427 opened this issue 3 years ago • 1 comments

The following wat program works fine in wat2wasm without function references enabled:

(module
  (func $example (export "example") (result funcref)
    ref.func $example))

However, enabling the "function references" feature causes the following error:

Error: validate failed:
test.wast:3:5: error: type mismatch in implicit return, expected [funcref] but got [(ref 0)]
    ref.func $example))
    ^^^^^^^^

It looks like ref 0 is not marked as a subtype of funcref.

Tested with the online demo: https://webassembly.github.io/wabt/demo/wat2wasm/

14427 avatar May 28 '23 19:05 14427

Thank you for testing this! As with https://github.com/WebAssembly/wabt/issues/2097 and https://github.com/WebAssembly/wabt/issues/1986 and https://github.com/WebAssembly/wabt/issues/1987 and #2089, AFAIK support for the function-references proposal remains a work in progress in WABT. We don't even mention function references in the README, and we're not running the function-references tests. (I think function-references may have been folded into the "gc" proposal in the meantime, but not sure?)

I think somebody who is interested in pushing this forward will have to complete support for the function-references or gc proposals, and claim support in the README, and add the proposal spec tests to WABT's testsuite, before we'd expect function references to work properly. Closing as essentially a dup of #1377 . If you want to work on this, we'd be very happy to help / review contributions that get these proposals supported!

keithw avatar May 29 '23 22:05 keithw