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

26 lines
220 B
Go

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