Skip to content

Commit 6871674

Browse files
committed
FIX: correcting datatype value detection logic
related to: Oldes/Rebol-issues#256
1 parent 8fb93e8 commit 6871674

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/core/t-block.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,11 @@ static void No_Nones_Or_Logic(REBVAL *arg) {
155155
for (; index >= start && index < end; index += skip) {
156156
value = BLK_SKIP(series, index);
157157
if (VAL_TYPE(value) == VAL_TYPE(target)) {
158-
if (IS_DATATYPE(target) && VAL_DATATYPE(value) == VAL_DATATYPE(target)) return index;
159-
else if EQUAL_TYPESET(value, target)
158+
if (IS_DATATYPE(target)) {
159+
if (VAL_DATATYPE(value) == VAL_DATATYPE(target))
160+
return index;
161+
}
162+
else if (EQUAL_TYPESET(value, target))
160163
return index;
161164
}
162165
if (flags & AM_FIND_MATCH) break;

src/tests/units/datatype-test.r3

+3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ Rebol [
3838
--assert ["aha"] = find reduce [integer! "aha"] series!
3939
--assert not none? find any-string! ref!
4040

41+
--assert 1 = index? find [#{00} #[string!] #[binary!]] #[binary!]
42+
--assert 3 = index? find/only [#{00} #[string!] #[binary!]] #[binary!]
43+
4144
--assert 2 = index? find/only reduce ["" string! any-string! binary!] string!
4245
--assert 3 = index? find/only reduce ["" string! any-string! binary!] any-string!
4346
--assert 1 = index? find reduce ["" string! any-string! binary!] any-string!

0 commit comments

Comments
 (0)