diff --git a/vm.go b/vm.go index 2e0240bc..74b7742e 100644 --- a/vm.go +++ b/vm.go @@ -536,6 +536,7 @@ func (v *VM) run() { v.sp++ default: v.err = fmt.Errorf("not indexable: %s", left.TypeName()) + return } case parser.OpCall: numArgs := int(v.curInsts[v.ip+1]) diff --git a/vm_test.go b/vm_test.go index 49c93ded..55a9289d 100644 --- a/vm_test.go +++ b/vm_test.go @@ -3638,6 +3638,7 @@ func TestSliceIndex(t *testing.T) { expectError(t, `undefined[:1]`, nil, "Runtime Error: not indexable") expectError(t, `123[-1:2]`, nil, "Runtime Error: not indexable") expectError(t, `{}[:]`, nil, "Runtime Error: not indexable") + expectError(t, `a := 123[-1:2] ; a += 1`, nil, "Runtime Error: not indexable") } func expectRun(