Can't append to struct's slice of functions
danielnovograd opened this issue · comments
Dan Novograd commented
The following program sample.go
triggers an unexpected result
package main
import "fmt"
type funclistItem func()
type funclist struct {
list []funclistItem
}
func main() {
funcs := funclist{}
funcs.list = append(funcs.list, func() { fmt.Println("first") })
for _, f := range funcs.list {
f()
}
}
Expected result
$ go run ./sample.go
// first
Got
$ yaegi ./sample.go
// reflect.Set: value of type *interp.node is not assignable to type func()
Yaegi Version
Additional Notes
First noticed this when trying to append a list of custom function types, but also breaks with func literals.