Skip to content
New issue

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

String indexing: panic #228

Open
vmarkovtsev opened this issue Jan 21, 2018 · 0 comments
Open

String indexing: panic #228

vmarkovtsev opened this issue Jan 21, 2018 · 0 comments

Comments

@vmarkovtsev
Copy link

The following code:

str := "123"
str[0] == '1'

panics with

ng eval panic: reflect: call of reflect.Value.SetInt on uint8 Value
goroutine 1 [running]:
runtime/debug.Stack(0x44, 0x0, 0x0)
	/usr/lib/go-1.9/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
	/usr/lib/go-1.9/src/runtime/debug/stack.go:16 +0x22
neugram.io/ng/eval.(*Program).Eval.func1(0xc42013a100, 0xc42011f610, 0xc42011f5f8)
	/home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:476 +0x204
panic(0xbb0f60, 0xc4201985e0)
	/usr/lib/go-1.9/src/runtime/panic.go:491 +0x283
reflect.Value.SetInt(0xb8dc20, 0xc42010462c, 0x188, 0x31)
	/usr/lib/go-1.9/src/reflect/value.go:1429 +0x135
neugram.io/ng/eval.convert(0xbcf2a0, 0xc420104628, 0x99, 0x1163e40, 0xb8dc20, 0xc420104571, 0x88, 0xc4200ff140)
	/home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:1347 +0x143e
neugram.io/ng/eval.(*Program).evalExpr(0xc42013a100, 0x1159c00, 0xc4200ff5c0, 0x0, 0x0, 0x0)
	/home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:1428 +0x11b3
neugram.io/ng/eval.(*Program).evalExpr(0xc42013a100, 0x1159c40, 0xc4200fb1c0, 0x0, 0x0, 0x0)
	/home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:1449 +0x3079
neugram.io/ng/eval.(*Program).evalStmt(0xc42013a100, 0x115a640, 0xc4200ff5f0, 0x0, 0x0, 0x0)
	/home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:885 +0x4655
neugram.io/ng/eval.(*Program).Eval(0xc42013a100, 0x115a640, 0xc4200ff5f0, 0xc4201540c0, 0x0, 0x0, 0x0, 0x11535c0, 0xc420100c60)
	/home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:497 +0x38c
main.handleResult(0x1, 0xc420100c40, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/vadim/Projects/go_unix/src/neugram.io/ng/ng.go:393 +0x7ff
main.loop(0xc400000000)
	/home/vadim/Projects/go_unix/src/neugram.io/ng/ng.go:385 +0x611
main.main()
	/home/vadim/Projects/go_unix/src/neugram.io/ng/ng.go:147 +0x641
ng: ng eval panic: reflect: call of reflect.Value.SetInt on uint8 Value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant