Skip to content

Commit ec40a24

Browse files
authored
FIX: Deep copy MAP values when cloning an OBJECT
Resolves: Oldes/Rebol-issues#2687
1 parent 7f3234e commit ec40a24

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/include/sys-core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ enum {
169169
#define TS_CODE ((CP_DEEP | TS_SERIES) & ~TS_NOT_COPIED)
170170

171171
#define TS_FUNCLOS (TYPESET(REB_FUNCTION) | TYPESET(REB_CLOSURE))
172-
#define TS_CLONE ((CP_DEEP | TS_SERIES | TS_FUNCLOS) & ~TS_NOT_COPIED)
172+
#define TS_CLONE ((CP_DEEP | TS_SERIES | TS_FUNCLOS | TYPESET(REB_MAP)) & ~TS_NOT_COPIED)
173173

174174
// Modes allowed by Bind related functions:
175175
enum {

src/tests/units/evaluation-test.r3

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,17 @@ Rebol [
508508
;@@ https://github.com/Oldes/Rebol-issues/issues/2686
509509
--assert #[num: [one two three]] = compose #[num: ([one two three])]
510510

511+
;@@ https://github.com/Oldes/Rebol-issues/issues/2687
512+
*obp: make object! [one: 1 two: 2 tmp: #[three: (one + two)]]
513+
*ob1: make *obp [one: 11]
514+
*ob2: make *obp [two: 22]
515+
*ob3: make *ob1 [two: 22]
516+
517+
--assert [3 13 23 33] = map-each obj reduce [*obp *ob1 *ob2 *ob3] [
518+
select compose/deep obj/tmp 'three
519+
]
520+
521+
511522
===end-group===
512523

513524
===start-group=== "unset value passing"

0 commit comments

Comments
 (0)