For WIT:
package test:repro;
interface repro {
variant var {
var(u8),
}
foo: func(var: var);
}
world imports {
import repro;
}
wasm-tools-go 0.3.0 generates inconsistent Var accessors.
In abi.go:
func lower_Var(v Var) (f0 uint32, f1 uint32) {
f0 = (uint32)(v.Tag())
switch f0 {
case 0: // var
v1 := (uint32)(*v.Var())
f1 = (uint32)(v1)
}
return
}
In repro.wit.go:
// Var_ returns a non-nil *[uint8] if [Var] represents the variant case "var".
func (self *Var) Var_() *uint8 {
return cm.Case[uint8](self, 0)
}
See https://github.com/rvolosatovs/wasm-tools-go-var-gen-repro for a full example
Update: naming the variant some other name, matching an identifier used in the interface causes the same issue
For WIT:
wasm-tools-go0.3.0 generates inconsistentVaraccessors.In
abi.go:In
repro.wit.go:See https://github.com/rvolosatovs/wasm-tools-go-var-gen-repro for a full example
Update: naming the variant some other name, matching an identifier used in the interface causes the same issue