Skip to content

Commit 62af92f

Browse files
committed
FIX: SAME? on VECTORs return TRUE even when vectors are not identical
fixes: metaeducation/rebol-issues#2400
1 parent 35815ce commit 62af92f

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/core/t-vector.c

+3
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,9 @@ void Set_Vector_Row(REBSER *ser, REBVAL *blk)
586586
/*
587587
***********************************************************************/
588588
{
589+
if (mode == 3)
590+
return VAL_SERIES(a) == VAL_SERIES(b) && VAL_INDEX(a) == VAL_INDEX(b);
591+
589592
REBINT n = Compare_Vector(a, b); // needs to be expanded for equality
590593
if (mode >= 0) {
591594
return n == 0;

src/tests/units/vector-test.r3

+12
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,18 @@ Rebol [
359359

360360
===start-group=== "VECTOR copy"
361361

362+
--test-- "COPY"
363+
;@@ https://github.com/rebol/rebol-issues/issues/2400
364+
v1: #[ui16! [1 2]]
365+
v2: v1
366+
v3: copy v2
367+
--assert same? v1 v2
368+
--assert not same? v1 v3
369+
v2/1: 3
370+
--assert v1/1 = 3
371+
--assert v3/1 = 1
372+
373+
362374
--test-- "COPY/PART"
363375
;@@ https://github.com/rebol/rebol-issues/issues/2399
364376
v: #[ui16! [1 2 3 4]]

0 commit comments

Comments
 (0)