diff --git a/gnovm/pkg/gnolang/values.go b/gnovm/pkg/gnolang/values.go index bc9af8e1a32..948730c4697 100644 --- a/gnovm/pkg/gnolang/values.go +++ b/gnovm/pkg/gnolang/values.go @@ -1543,8 +1543,7 @@ func (tv *TypedValue) ComputeMapKey(store Store, omitType bool) MapKey { bz = append(bz, '{') for i := 0; i < sl; i++ { fv := fillValueTV(store, &sv.Fields[i]) - ft := bt.Fields[i] - omitTypes := ft.Elem().Kind() != InterfaceKind + omitTypes := bt.Fields[i].Type.Kind() != InterfaceKind bz = append(bz, fv.ComputeMapKey(store, omitTypes)...) if i != sl-1 { bz = append(bz, ',') diff --git a/gnovm/tests/files/struct58.gno b/gnovm/tests/files/struct58.gno new file mode 100644 index 00000000000..d1d650f47af --- /dev/null +++ b/gnovm/tests/files/struct58.gno @@ -0,0 +1,23 @@ +package main + +type I interface { + dummy() +} +type IS struct{} + +func (iss IS) dummy() { +} + +type S struct { + x int + I +} + +func main() { + m := make(map[S]string) + m[S{0, IS{}}] = "test" + println(m) +} + +// Output: +// map{(struct{(0 int),(struct{} main.IS)} main.S):("test" string)}