Skip to content

Commit

Permalink
FIX: COPY/part on VECTOR is silently ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Feb 5, 2020
1 parent 1162e7d commit 35815ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/t-vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ void Set_Vector_Row(REBSER *ser, REBVAL *blk)
REBSER *ser;
REBSER *blk;
REBVAL *val;
REBINT len;

type = Do_Series_Action(action, value, arg);
if (type >= 0) return type;
Expand Down Expand Up @@ -742,7 +743,8 @@ void Set_Vector_Row(REBSER *ser, REBVAL *blk)
return R_RET;

case A_COPY:
ser = Copy_Series(vect);
len = Partial(value, 0, D_ARG(3), 0); // Can modify value index.
ser = Copy_Series_Part(vect, VAL_INDEX(value), len);
ser->size = vect->size; // attributes
SET_VECTOR(value, ser);
break;
Expand Down
11 changes: 11 additions & 0 deletions src/tests/units/vector-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -357,4 +357,15 @@ Rebol [

===end-group===

===start-group=== "VECTOR copy"

--test-- "COPY/PART"
;@@ https://github.com/rebol/rebol-issues/issues/2399
v: #[ui16! [1 2 3 4]]
--assert 2 = length? copy/part v 2
--assert #{01000200} = to-binary copy/part v 2
--assert #{03000400} = to-binary copy/part skip v 2 2

===end-group===

~~~end-file~~~

0 comments on commit 35815ce

Please sign in to comment.