Skip to content

Commit b71b420

Browse files
committed
FEAT: VECTOR can be initialized using a block with CHARs
Implements: metaeducation/rebol-issues#2348
1 parent 4cfb7a3 commit b71b420

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/core/t-vector.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void Set_Vector_Row(REBSER *ser, REBVAL *blk)
168168
val = VAL_BLK_DATA(blk);
169169

170170
for (; NOT_END(val); val++) {
171-
if (IS_INTEGER(val)) {
171+
if (IS_INTEGER(val) || IS_CHAR(val)) {
172172
i = VAL_INT64(val);
173173
if (bits > VTUI64) f = (REBDEC)(i);
174174
}

src/tests/units/series-test.r3

+10
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,16 @@ Rebol [
176176
;@@ https://github.com/rebol/rebol-issues/issues/1036
177177
--assert 2 = index? load mold/all next make vector! [integer! 32 4 [1 2 3 4]]
178178

179+
--test-- "VECTOR can be initialized using a block with CHARs"
180+
;@@ https://github.com/rebol/rebol-issues/issues/2348
181+
--assert vector? v: make vector! [integer! 8 [#"^(00)" #"^(01)" #"^(02)" #"a" #"b"]]
182+
--assert 0 = v/1
183+
--assert 98 = v/5
184+
185+
--assert vector? v: make vector! [integer! 16 [#"^(00)" #"^(01)" #"^(02)" #"a" #"b"]]
186+
--assert 0 = v/1
187+
--assert 98 = v/5
188+
179189
===end-group===
180190

181191
~~~end-file~~~

0 commit comments

Comments
 (0)