Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
- [#281](https://github.com/bytecodealliance/go-modules/issues/281): errors from internal `wasm-tools` calls are no longer silently ignored. This required fixing a number of related issues, including synthetic world packages for Component Model metadata generation, WIT generation, and WIT keyword escaping in WIT package or interface names.
- [#284](https://github.com/bytecodealliance/go-modules/issues/284): do not use `bool` for `variant` or `result` GC shapes. TinyGo returns `result` and `variant` values with `bool` as 0 or 1, which breaks the memory representation of tagged unions (variants).
- [#288](https://github.com/bytecodealliance/go-modules/issues/288): correctly report the `wasm32` ABI alignment of `list<T>` as 4, rather than 8.
- [#306](https://github.com/bytecodealliance/go-modules/issues/306): run `wasm-tools` with the `--all-features` argument so feature-gated WIT is correctly found when synthesizing Component Model metadata for a Go package.

## [v0.5.0] — 2024-12-14

Expand Down
19 changes: 19 additions & 0 deletions testdata/issues/issue306.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// https://github.com/bytecodealliance/go-modules/issues/306
package issues:issue306;

world w {
include issues:dep1/w;
}

package issues:dep1 {
world w {
import issues:dep2/gated-interface;
}
}

package issues:dep2 {
@unstable(feature = some-feature-gate)
interface gated-interface {
f: func(v: u64) -> s32;
}
}
80 changes: 80 additions & 0 deletions testdata/issues/issue306.wit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"worlds": [
{
"name": "w",
"imports": {
"interface-0": {
"interface": {
"id": 0
}
}
},
"exports": {},
"package": 1
},
{
"name": "w",
"imports": {
"interface-0": {
"interface": {
"id": 0
}
}
},
"exports": {},
"package": 2
}
],
"interfaces": [
{
"name": "gated-interface",
"types": {},
"functions": {
"f": {
"name": "f",
"kind": "freestanding",
"params": [
{
"name": "v",
"type": "u64"
}
],
"result": "s32"
}
},
"stability": {
"unstable": {
"feature": "some-feature-gate"
}
},
"package": 0
}
],
"types": [],
"packages": [
{
"name": "issues:dep2",
"interfaces": {
"gated-interface": 0
},
"worlds": {}
},
{
"name": "issues:dep1",
"interfaces": {},
"worlds": {
"w": 0
}
},
{
"name": "issues:issue306",
"docs": {
"contents": "https://github.com/bytecodealliance/go-modules/issues/306"
},
"interfaces": {},
"worlds": {
"w": 1
}
}
]
}
19 changes: 19 additions & 0 deletions testdata/issues/issue306.wit.json.golden.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package issues:dep1;

world w {
import issues:dep2/gated-interface;
}

/// https://github.com/bytecodealliance/go-modules/issues/306
package issues:issue306 {
world w {
import issues:dep2/gated-interface;
}
}

package issues:dep2 {
@unstable(feature = some-feature-gate)
interface gated-interface {
f: func(v: u64) -> s32;
}
}
2 changes: 1 addition & 1 deletion wit/bindgen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2417,7 +2417,7 @@ func (g *generator) componentEmbed(witData string) ([]byte, error) {

// TODO: --all-features?
filename := "component.wit"
args := []string{"component", "embed", "--only-custom", filename}
args := []string{"component", "embed", "--only-custom", "--all-features", filename}
fsMap := map[string]fs.FS{
"": fstest.MapFS{
filename: &fstest.MapFile{Data: []byte(witData)},
Expand Down