mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-01 00:49:47 +00:00
This allows to fix the reassignment of an non empty interface value.
Before, reassignment was limited to empty interfaces.
Fixes #1138.
23 lines
277 B
Go
23 lines
277 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
)
|
|
|
|
type T struct {
|
|
r io.Reader
|
|
}
|
|
|
|
func (t *T) Read(p []byte) (n int, err error) { n, err = t.r.Read(p); return }
|
|
|
|
func main() {
|
|
x := io.LimitedReader{}
|
|
y := io.Reader(&x)
|
|
y = &T{y}
|
|
fmt.Println(y.Read([]byte("")))
|
|
}
|
|
|
|
// Output:
|
|
// 0 EOF
|