reflect: call of reflect.Value.Uint on int Value
ISNing opened this issue · 0 comments
ISNing commented
The following program sample.go
triggers an unexpected result
package main
func f(b uint) uint {
return uint(1) + (0x1 >> b)
}
func main() {
println(f(1))
}
Expected result
$ go run ./sample.go
1
Got
$ yaegi ./sample.go
./sample.go:4:9: panic: main.f(...)
./sample.go:8:13: panic: main.main(...)
run: reflect: call of reflect.Value.Uint on int Value
goroutine 1 [running]:
runtime/debug.Stack()
/usr/lib/go-1.21/src/runtime/debug/stack.go:24 +0x5e
github.com/traefik/yaegi/interp.(*Interpreter).Execute.func1()
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/interp/program.go:146 +0x7e
panic({0xdbe800?, 0xc0004de420?})
/usr/lib/go-1.21/src/runtime/panic.go:914 +0x21f
github.com/traefik/yaegi/interp.runCfg.func1()
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/interp/run.go:226 +0x177
panic({0xdbe800?, 0xc0004de420?})
/usr/lib/go-1.21/src/runtime/panic.go:914 +0x21f
github.com/traefik/yaegi/interp.runCfg.func1()
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/interp/run.go:226 +0x177
panic({0xdbe800?, 0xc0004de420?})
/usr/lib/go-1.21/src/runtime/panic.go:914 +0x21f
reflect.Value.Uint(...)
/usr/lib/go-1.21/src/reflect/value.go:2692
github.com/traefik/yaegi/interp.genValueUint.func2(0xd86580?)
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/interp/value.go:482 +0xaf
github.com/traefik/yaegi/interp.add.func10(0x4717d3?)
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/interp/op.go:104 +0x3a
github.com/traefik/yaegi/interp.runCfg(0xc00070c500, 0xc0000f2630, 0xc00033b930?, 0xd86780?)
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/interp/run.go:234 +0x285
github.com/traefik/yaegi/interp.call.func9(0xc0000f2580)
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/interp/run.go:1401 +0x7ec
github.com/traefik/yaegi/interp.runCfg(0xc00070da40, 0xc0000f2580, 0xc00033b9b8?, 0x0?)
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/interp/run.go:234 +0x285
github.com/traefik/yaegi/interp.(*Interpreter).run(0xc000105440, 0xc00070cdc0, 0xc0000f2420?)
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/interp/run.go:119 +0x3c5
github.com/traefik/yaegi/interp.(*Interpreter).Execute(0xc000105440, 0xc00031d320)
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/interp/program.go:172 +0x225
github.com/traefik/yaegi/interp.(*Interpreter).eval(0xc000105440, {0xc0000b6150?, 0x66?}, {0x7ffd2df11a23?, 0x200?}, 0x0?)
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/interp/interp.go:563 +0x55
github.com/traefik/yaegi/interp.(*Interpreter).EvalPath(0xc000105440, {0x7ffd2df11a23, 0xb})
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/interp/interp.go:512 +0xa6
main.runFile(0x7ffd2df11a23?, {0x7ffd2df11a23, 0xb}, 0x0)
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/cmd/yaegi/run.go:153 +0xd7
main.run({0xc000036050?, 0x1, 0x1})
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/cmd/yaegi/run.go:116 +0xb97
main.main()
/home/isning/go/pkg/mod/github.com/traefik/yaegi@v0.16.1/cmd/yaegi/yaegi.go:144 +0x2af
Yaegi Version
v0.16.1
Additional Notes
No response