fix: dont assign receiver on indexExpr

This commit is contained in:
Nicholas Wiersma
2020-06-03 19:10:04 +02:00
committed by GitHub
parent 74479d70e6
commit def57d57c2
2 changed files with 18 additions and 1 deletions

18
_test/method32.go Normal file
View File

@@ -0,0 +1,18 @@
package main
import (
"fmt"
)
func main() {
var a = []func(string){bar}
b := a[0]
b("bar")
}
func bar(a string) {
fmt.Println(a)
}
// Output:
// bar

View File

@@ -721,7 +721,6 @@ func (interp *Interpreter) cfg(root *node, pkgID string) ([]*node, error) {
n.typ = t.val
}
n.findex = sc.add(n.typ)
n.recv = &receiver{node: n}
typ := t.TypeOf()
switch k := typ.Kind(); k {
case reflect.Map: