See https://play.golang.org/p/5x9JrD55WKc
The interfaces aer and ber look equivalent.
Both contain a function which returns nothing called m1
and a function which returns another an instance of the interface m2.
If we comment out m2, then the code will compile.
But otherwise we get an error:
./prog.go:14:5: cannot use a (type aer) as type ber in argument to bar: aer
does not implement ber (wrong type for m2 method) have m2() aer want m2()
ber
even though aer and ber should be equivalent!
package main
type aer interface {
m1()
m2() aer
}
type ber interface {
m1()
m2() ber
}
func Foo(a aer) {
bar(a)
}
func bar(b ber) {
}
func main() {
}
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/4112dd4a-f2b3-4469-806e-233f242f93f9n%40googlegroups.com.