We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following program sample.go triggers a panic:
sample.go
package main type S struct { a int } func main() { var i interface{} = S{a: 1} s, ok := i.(S) if !ok { println("bad") return } println(s.a) }
Expected result:
$ go run ./sample.go 1
Got:
$ yaegi ./sample.go _test/test.go:8:8: panic reflect.Set: value of type struct { Xa int } is not assignable to type interp.valueInterface goroutine 1 [running]: runtime/debug.Stack(0x1, 0xc0002f0600, 0x40) /usr/local/Cellar/go/1.14.4/libexec/src/runtime/debug/stack.go:24 +0x9d github.com/containous/yaegi/interp.(*Interpreter).Eval.func1(0xc0001adde0) /Users/nrwiersma/Go/src/github.com/containous/yaegi/interp/interp.go:333 +0xbc panic(0x191b6c0, 0xc00009a830) /usr/local/Cellar/go/1.14.4/libexec/src/runtime/panic.go:969 +0x166 github.com/containous/yaegi/interp.runCfg.func1(0xc00036c0a0, 0xc000375400) /Users/nrwiersma/Go/src/github.com/containous/yaegi/interp/run.go:116 +0x20c panic(0x191b6c0, 0xc00009a830) /usr/local/Cellar/go/1.14.4/libexec/src/runtime/panic.go:969 +0x166 reflect.Value.assignTo(0xc000096360, 0xc000369c30, 0x199, 0x1a57815, 0xb, 0x19a2b80, 0x0, 0xc000324840, 0xc000369c58, 0xc00037e000) /usr/local/Cellar/go/1.14.4/libexec/src/reflect/value.go:2403 +0x426 reflect.Value.Set(0x19a2b80, 0xc00009ee40, 0x199, 0xc000096360, 0xc000369c30, 0x199) /usr/local/Cellar/go/1.14.4/libexec/src/reflect/value.go:1532 +0xbd github.com/containous/yaegi/interp.doCompositeSparse.func1(0xc00036c0a0, 0xc0000a4980) /Users/nrwiersma/Go/src/github.com/containous/yaegi/interp/run.go:2116 +0x264 github.com/containous/yaegi/interp.runCfg(0xc000375400, 0xc00036c0a0) /Users/nrwiersma/Go/src/github.com/containous/yaegi/interp/run.go:122 +0x6d github.com/containous/yaegi/interp.(*Interpreter).run(0xc0000be1a0, 0xc000374a00, 0xc00036c000) /Users/nrwiersma/Go/src/github.com/containous/yaegi/interp/run.go:100 +0x239 github.com/containous/yaegi/interp.(*Interpreter).Eval(0xc0000be1a0, 0xc0002cce60, 0x9b, 0x0, 0x0, 0x0, 0x0, 0x0) /Users/nrwiersma/Go/src/github.com/containous/yaegi/interp/interp.go:409 +0x52b main.main() /Users/nrwiersma/Go/src/github.com/containous/yaegi/cmd/yaegi/yaegi.go:159 +0x65d
The text was updated successfully, but these errors were encountered:
nrwiersma
Successfully merging a pull request may close this issue.
The following program
sample.go
triggers a panic:Expected result:
Got:
The text was updated successfully, but these errors were encountered: