(pasted below) but i get
cannot use newAny() (type any) as type all in field value: need type
assertion
"all" is allowed to be an "any" in "newAny" but isn't allowed to be an
"any" when embedded in "allThing"?
package main
import "fmt"
type any interface{}
type all struct{}
func newAny() any {
return all{}
}
type anyThing interface {
any
}
type allThing struct {
all
}
func newThing() anyThing {
return allThing{all: newAny()} // This is not allowed
}
func main() {
n := newThing()
fmt.Printf("%T %+v", n, n)
}
Thanks
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.