Files
Marc VertesandGitHub c77dc1c4c5 interp: fix use of function as field of a recursive struct.
The logic of patching reflect struct representation has been fixed in presence of function fields and to better handle indirect recursivity (struct recursive through nested struct).

Fixes #1519.
2023-03-21 11:50:05 +01:00

28 lines
249 B
Go

package main
type F func(a *A)
type A struct {
B string
D
f F
}
type D struct {
*A
E *A
}
func f1(a *A) { println("in f1", a.B) }
func main() {
a := &A{B: "b", f: f1}
a.D = D{E: a}
println(a.D.E.B)
a.f(a)
}
// Output:
// b
// in f1 b