Is Go type parameter supports interface union?
My case
type MessageSpec interface { MessageA | MessageB }
type MessageA interface { ID() uint64 }
type MessageB interface { Uid() uint64 }
but got compile error:
./prog.go:14:2: cannot use main.MessageA in union (main.MessageA contains methods)
./prog.go:14:13: cannot use main.MessageB in union (main.MessageB contains methods)
There's example
> type Stringish interface {
string | fmt.Stringer
}
but it also throwing error
> ./prog.go:19:11: cannot use fmt.Stringer in union (fmt.Stringer contains methods)
Is this a bug? i know my case is not the same thing as like the one i referenced from the proposal
but it is throwing the same error.
Thanks