mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-01 00:49:47 +00:00
Special wrapping of interface value at return is no longer necessary and must be avoided now. Fixes #1179.
24 lines
268 B
Go
24 lines
268 B
Go
package main
|
|
|
|
type I interface {
|
|
F()
|
|
}
|
|
|
|
type T struct {
|
|
Name string
|
|
}
|
|
|
|
func (t *T) F() { println("in F", t.Name) }
|
|
|
|
func NewI(s string) I { return newT(s) }
|
|
|
|
func newT(s string) *T { return &T{s} }
|
|
|
|
func main() {
|
|
i := NewI("test")
|
|
i.F()
|
|
}
|
|
|
|
// Output:
|
|
// in F test
|