mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-01 00:49:47 +00:00
The function `getMethodByName()` is now able to look for
embedded `valueInterface` field for matching methods in interface
struct fields.
Fixes #1439 and #1427.
26 lines
268 B
Go
26 lines
268 B
Go
package main
|
|
|
|
type Transformer interface {
|
|
Reset()
|
|
}
|
|
|
|
type Encoder struct {
|
|
Transformer
|
|
}
|
|
|
|
type nop struct{}
|
|
|
|
func (nop) Reset() { println("Reset") }
|
|
|
|
func f(e Transformer) {
|
|
e.Reset()
|
|
}
|
|
|
|
func main() {
|
|
e := Encoder{Transformer: nop{}}
|
|
f(e)
|
|
}
|
|
|
|
// Output:
|
|
// Reset
|