Skip to content

wit/bindgen: flattened worlds with versioned feature gates cannot be correctly serialized  #306

@rvolosatovs

Description

@rvolosatovs

Bindgen from latest main (cfe612d) fails to generate bindings for:

package repro:repro@0.1.0;

world importsx {
    include wasi:cli/imports@0.2.1;
}

when invoked via:

go run go.bytecodealliance.org/cmd/wit-bindgen-go generate -w importsx -o bindings ./wit

There's a lot of output, but last lines are:

error: wasm-tools: error: interface not found in package
     --> component.wit:35:21
      |
   35 | 	import wasi:clocks/timezone@0.2.1;
      |                     ^-------

exit status 1

It successfully generates bindings, however, for:

package repro:repro@0.1.0;

world imports {
    include wasi:cli/imports@0.2.1;
}

when invoked via:

go run go.bytecodealliance.org/cmd/wit-bindgen-go generate -w imports -o bindings ./wit

It seems that naming the world anything other than imports triggers this bug. I'm not sure if it's somehow correlated with the fact that the included world's name is also imports, but I would guess that's what's causing this.

Reproducer available at https://github.com/rvolosatovs/go-bindgen-repro

See rvolosatovs/go-bindgen-repro@766add4 for a working setup (with the world named imports)

env:

wasm-tools 1.227.1
go version go1.23.5 darwin/arm64

Seems related to #281
maybe related to #285 ?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions