Skip to content

Commit

Permalink
FIX: APPEND a word on object should set the value to NONE instead of …
Browse files Browse the repository at this point in the history
…UNSET

related to: metaeducation/rebol-issues#708
  • Loading branch information
Oldes committed Feb 9, 2020
1 parent 70a3314 commit 15f6ea5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/t-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ static void Append_Obj(REBSER *obj, REBVAL *arg)
if ((VAL_WORD_CANON(arg) == SYM_SELF) && !IS_SELFLESS(obj))
Trap0(RE_SELF_PROTECTED);
Expand_Frame(obj, 1, 1); // copy word table also
Append_Frame(obj, 0, VAL_WORD_SYM(arg));
// val is UNSET
val = Append_Frame(obj, 0, VAL_WORD_SYM(arg));
SET_NONE(val);
}
return;
}
Expand Down
14 changes: 14 additions & 0 deletions src/tests/units/object-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,18 @@ Rebol [

===end-group===

===start-group=== "APPEND on OBJECT"
;@@ https://github.com/rebol/rebol-issues/issues/708
--test-- "issue-708"
o: object []
append o 'x
--assert none? o/x
append o [y]
--assert none? o/y
append o [x: 1 y: 2]
--assert o/x = 1
--assert o/y = 2

===end-group===

~~~end-file~~~

0 comments on commit 15f6ea5

Please sign in to comment.