Open karelorigin opened 1 year ago
I tested it with yaegi-0.15.1 and the result is correct. I can not reproduce this issue.
Seems like my Yaegi binary was still on v0.15.0, sorry about that. Though I initially discovered came across a panic in similar code (from tip), so I figured this was reproducing that issue, but it may be something else entirely.
I can't seem to create an easily reproducible sample for some reason. Though this is where the panic occurs:
and this is the message that accompanies it:
panic: reflect.Set: value of type *struct { Embedded struct { Type int }; Func func(*unsafe2.dummy) (bool, error) } is not assignable to type *struct { Embedded struct { Type int }; Func func(*unsafe2.dummy) (bool, error) }
The Func
field function signature is something like: func(*T) (bool, error)
and the panic disappears when I change it from a concrete type to an interface, such as : func(interface{}) (bool, error)
.
Hopefully that helps.
The following program
sample.go
triggers an unexpected resultExpected result
Got
Yaegi Version
v0.15.1
Additional Notes
I believe Yaegi internally creates its own type equivalents, so that may have something to do with it.