Skip to content

Add support for named implements in Go#1657

Open
jfleitz wants to merge 4 commits into
bytecodealliance:mainfrom
jfleitz:jfleitz/go-implements
Open

Add support for named implements in Go#1657
jfleitz wants to merge 4 commits into
bytecodealliance:mainfrom
jfleitz:jfleitz/go-implements

Conversation

@jfleitz

@jfleitz jfleitz commented Jul 17, 2026

Copy link
Copy Markdown

Fixes #1642

Overview

In the scenario where you are importing the same interface under multiple names (implements feature in wasm), the Go generator only emitted the interface types from the first package, since there is a check for not adding a duplicate interface.

This change adds the Go package name to the Hash key instead of just TypeId, allowing for all interfaces to be exported in all packages. There is no concern on duplicate interfaces in the same package, since that would be a Go compile error.

C++ bin gen was also changed to support the implements feature as well, with using the derived namespace in the WorldKey (primary::Bucket, secondary::Bucket).

Testing

  • Added tests/codegen/issue1642.wit importing the same interface with two names (to test implements) as well as non-named (to test prior functionality)
  • Verified with local wit-bindgen go and re-generated the bindings for the implements-test project.

Signed-off-by: Jeremy Fleitz jeremy@cosmonic.com

jfleitz added 2 commits July 17, 2026 15:41
Signed-off-by: Jeremy Fleitz <jeremy@cosmonic.com>
Signed-off-by: Jeremy Fleitz <jeremy@cosmonic.com>
@alexcrichton
alexcrichton requested a review from dicej July 17, 2026 20:22
jfleitz added 2 commits July 17, 2026 16:40
Signed-off-by: Jeremy Fleitz <jeremy@cosmonic.com>
Signed-off-by: Jeremy Fleitz <jeremy@cosmonic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Go: resource failed to be generated for implements feature

1 participant