mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-01 00:49:47 +00:00
* interp: handle struct with multiple recursive fields In case of a recursive struct with several recursive fields of different type, only the first one was properly fixed when constructing the corresponding reflect type. We now memorize and process all fields at the same depth level. Fixes #1371. * Update interp/type.go Co-authored-by: mpl <[email protected]> * fix lint * fix comment Co-authored-by: mpl <[email protected]>
19 lines
223 B
Go
19 lines
223 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
type node struct {
|
|
parent *node
|
|
child []*node
|
|
key string
|
|
}
|
|
|
|
func main() {
|
|
root := &node{key: "root"}
|
|
root.child = nil
|
|
fmt.Println("root:", root)
|
|
}
|
|
|
|
// Output:
|
|
// root: &{<nil> [] root}
|