-
Notifications
You must be signed in to change notification settings - Fork 386
Closed
Description
The following program sample.go
triggers a panic:
package main
const maxlen = len([...]int{1, 2, 3})
var gfm = [maxlen]byte{}
func main() {
println(len(gfm))
}
Expected result:
$ go run ./sample.go
3
Got:
$ yaegi ./sample.go
run: reflect: call of reflect.Value.Interface on zero Value
goroutine 1 [running]:
runtime/debug.Stack(0x1, 0xc0002e8600, 0x40)
/usr/lib/go/src/runtime/debug/stack.go:24 +0x9f
github.com/traefik/yaegi/interp.(*Interpreter).eval.func1(0xc00021dc70)
/home/marc/go/src/github.com/traefik/yaegi/interp/interp.go:485 +0xc5
panic(0xe06c40, 0xc000204e40)
/usr/lib/go/src/runtime/panic.go:969 +0x1b9
reflect.valueInterface(0x0, 0x0, 0x0, 0xc00036b101, 0x0, 0x1)
/usr/lib/go/src/reflect/value.go:1021 +0x1ad
reflect.Value.Interface(...)
/usr/lib/go/src/reflect/value.go:1016
github.com/traefik/yaegi/interp.nodeType(0xc000366000, 0xc00021e300, 0xc00046ec00, 0xc00036b180, 0x0, 0x1)
/home/marc/go/src/github.com/traefik/yaegi/interp/type.go:205 +0x2c9d
github.com/traefik/yaegi/interp.nodeType(0xc000366000, 0xc00021e300, 0xc00046eb00, 0x6, 0xc0002215a8, 0x0)
/home/marc/go/src/github.com/traefik/yaegi/interp/type.go:372 +0x527b
github.com/traefik/yaegi/interp.(*Interpreter).gta.func1(0xc00046e900, 0xc000200600)
/home/marc/go/src/github.com/traefik/yaegi/interp/gta.go:65 +0x898
github.com/traefik/yaegi/interp.(*node).Walk(0xc00046e900, 0xc00021da28, 0x0)
/home/marc/go/src/github.com/traefik/yaegi/interp/interp.go:218 +0xb5
github.com/traefik/yaegi/interp.(*node).Walk(0xc00046e800, 0xc00021da28, 0x0)
/home/marc/go/src/github.com/traefik/yaegi/interp/interp.go:222 +0x66
github.com/traefik/yaegi/interp.(*node).Walk(0xc00046e000, 0xc00021da28, 0x0)
/home/marc/go/src/github.com/traefik/yaegi/interp/interp.go:222 +0x66
github.com/traefik/yaegi/interp.(*Interpreter).gta(0xc000366000, 0xc00046e000, 0xc000211930, 0x4, 0xc000211930, 0x4, 0xc00020e380, 0xc00021daf8, 0x51cce5, 0xc000366040, ...)
/home/marc/go/src/github.com/traefik/yaegi/interp/gta.go:20 +0x1f8
github.com/traefik/yaegi/interp.(*Interpreter).gtaRetry(0xc000366000, 0xc00021dbe0, 0x1, 0x1, 0xc000211930, 0x4, 0xc000211930, 0x4)
/home/marc/go/src/github.com/traefik/yaegi/interp/gta.go:306 +0x12c
github.com/traefik/yaegi/interp.(*Interpreter).eval(0xc000366000, 0xc00020e380, 0x68, 0x7ffd4a35d993, 0x16, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/marc/go/src/github.com/traefik/yaegi/interp/interp.go:507 +0x295
github.com/traefik/yaegi/interp.(*Interpreter).EvalPath(0xc000366000, 0x7ffd4a35d993, 0x16, 0xc00020e300, 0x68, 0x0, 0x0, 0xc000221040)
/home/marc/go/src/github.com/traefik/yaegi/interp/interp.go:399 +0xfa
main.runFile(0xc000366000, 0x7ffd4a35d993, 0x16, 0xc000200480, 0x1)
/home/marc/go/src/github.com/traefik/yaegi/cmd/yaegi/run.go:123 +0xae
main.run(0xc00000e090, 0x1, 0x1, 0x13, 0x13)
/home/marc/go/src/github.com/traefik/yaegi/cmd/yaegi/run.go:89 +0x7e5
main.main()
/home/marc/go/src/github.com/traefik/yaegi/cmd/yaegi/yaegi.go:144 +0x415