Closed
Description
Description
In Go language, user is able to define a custom type on top of a built-in type.
For example:
type Set map[string]struct{}
func NewSet(items ...string) Set {
...
}
func (s Set) Has(key string) bool {
_, ok := s[key]
return ok
}
When I'm trying to use the same type, I get a following error:
recovered: interface conversion: gnolang.Type is *gnolang.DeclaredType, not *gnolang.MapType
stack:
goroutine 60 [running]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/gnolang/gno/pkgs/sdk.(*BaseApp).runTx.func1()
/opt/build/pkgs/sdk/baseapp.go:743 +0x2cd
panic({0xc60820, 0xc014450700})
/usr/local/go/src/runtime/panic.go:884 +0x212
...
The same code but without custom map type works.
Looks like, Gno doesn't support this kind of stuff. I checked Go and Gno compat guide but it didn't mention this limitation.
Can you please update the compat doc?
Metadata
Metadata
Assignees
Type
Projects
Status