cmd/compile: recursive anonymous interface defs compile but fail to run #10222
Closed
Description
Should this program work?
package main
type T interface {
m() interface {T}
}
type foo struct {
}
func (f *foo) m() interface {T} {
return &foo{}
}
func main() {
var t T
t = &foo{}
t.m()
}
It seems to compile but panics when run:
http://play.golang.org/p/swxTnFlwQI
By contrast this program works fine:
package main
type T interface {
m() T
}
type foo struct {
}
func (f *foo) m() T {
return &foo{}
}
func main() {
var t T
t = &foo{}
t.m()
}