interp: fix type check of methods with a receiver of interface kind
Fixes #1280.
This commit is contained in:
30
_test/issue-1280.go
Normal file
30
_test/issue-1280.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
type DBReader interface {
|
||||
io.ReadCloser
|
||||
io.ReaderAt
|
||||
}
|
||||
|
||||
type DB struct {
|
||||
f DBReader
|
||||
}
|
||||
|
||||
func main() {
|
||||
f, err := os.Open("/dev/null")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
d := &DB{f}
|
||||
data := make([]byte, 1)
|
||||
_, _ = d.f.ReadAt(data, 0)
|
||||
println("bye")
|
||||
}
|
||||
|
||||
// Output:
|
||||
// bye
|
||||
@@ -1071,7 +1071,7 @@ func (t *itype) in(i int) *itype {
|
||||
return t.arg[i]
|
||||
case valueT:
|
||||
if t.rtype.Kind() == reflect.Func {
|
||||
if t.recv != nil {
|
||||
if t.recv != nil && !isInterface(t.recv) {
|
||||
i++
|
||||
}
|
||||
if t.rtype.IsVariadic() && i == t.rtype.NumIn()-1 {
|
||||
|
||||
Reference in New Issue
Block a user