Skip to content

Commit

Permalink
FIX: find/same and select/same working with any-word!
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Oct 13, 2020
1 parent b53caf8 commit 6129eca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/t-block.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static void No_Nones_Or_Logic(REBVAL *arg) {
value = BLK_SKIP(series, index);
if (ANY_WORD(value)) {
cnt = (VAL_WORD_SYM(value) == VAL_WORD_SYM(target));
if (flags & AM_FIND_CASE) {
if (flags & (AM_FIND_CASE | AM_FIND_SAME)) {
// Must be same type and spelling:
if (cnt && VAL_TYPE(value) == VAL_TYPE(target)) return index;
}
Expand Down
8 changes: 8 additions & 0 deletions src/tests/units/series-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ Rebol [
--assert 2 = index? find b :obj1
--assert 2 = index? find b :obj2
--assert 2 = index? find/case b :obj2 ;/case is not /same in this case
b: [a a: 'a :a]
--assert 1 = index? find/same b b/1
--assert 2 = index? find/same b b/2
--assert 3 = index? find/same b b/3
--assert 4 = index? find/same b b/4
--assert 1 = index? find b b/1
--assert 1 = index? find b b/2
--assert 1 = index? find b b/3

--test-- "FIND/SAME in string!"
--assert "AbcdAe" = find/same "aAbcdAe" "A"
Expand Down

0 comments on commit 6129eca

Please sign in to comment.