Skip to content

Commit

Permalink
FIX: set with any-block types
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Feb 25, 2022
1 parent 070c6b2 commit 811d229
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/n-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
** REBOL [R3] Language Interpreter and Run-time Environment
**
** Copyright 2012 REBOL Technologies
** Copyright 2012-2021 Rebol Open Source Developers
** Copyright 2012-2022 Rebol Open Source Developers
** REBOL is a trademark of REBOL Technologies
**
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -581,7 +581,7 @@ static int Check_Char_Range(REBVAL *val, REBINT limit)
}

// Is value a block?
if (IS_BLOCK(val)) {
if (ANY_BLOCK(val)) {
if (not_only) val = VAL_BLK_DATA(val);
if (IS_END(val)) val = NONE_VALUE;
else is_blk = TRUE;
Expand Down
35 changes: 34 additions & 1 deletion src/tests/units/evaluation-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,40 @@ Rebol [
--assert error? try [set [/e][5]]
--assert error? try [set [#f][6]]
--assert error? try [set /a 1]


--test-- "set any block"
;@@ https://github.com/Oldes/Rebol-issues/issues/2488
--assert all [
[[][]] = set [a b] first [[[][]]]
a = []
b = []
]
--assert all [
paren? set [a b] first [([][])]
a = []
b = []
]
--assert all [
path? set [a b] first [x/y]
a = 'x
b = 'y
]
--assert all [
[[][]] = set/only [a b] val: first [[[][]]]
a = val
b = val
]
--assert all [
paren? set/only [a b] val: first [([][])]
a = val
b = val
]
--assert all [
path? set/only [a b] val: first [x/y]
a = val
b = val
]

--test-- "set path"
;@@ https://github.com/Oldes/Rebol-issues/issues/2275
;Parenthesized expressions on left for SET-PATH! evaluate after right hand expressions
Expand Down

0 comments on commit 811d229

Please sign in to comment.