File tree 2 files changed +27
-2
lines changed
2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 221
221
REBCNT * hashes ;
222
222
REBCNT hash ;
223
223
REBCNT n ;
224
+ REBVAL * set ;
224
225
225
226
if (IS_NONE (key ) || hser == NULL ) return 0 ;
226
227
248
249
// append key
249
250
if (ANY_WORD (key ) && VAL_TYPE (key ) != REB_SET_WORD ) {
250
251
// Normalize the KEY (word) to be a SET-WORD
251
- REBVAL * set = Append_Value (series );
252
+ set = Append_Value (series );
252
253
* set = * key ;
253
254
VAL_SET (set , REB_SET_WORD );
255
+ } else if (ANY_BINSTR (key ) && !IS_LOCK_SERIES (VAL_SERIES (key ))) {
256
+ // copy the key if it is any-series (except when it is permanently locked)
257
+ set = Append_Value (series );
258
+ VAL_SERIES (set ) = Copy_String (VAL_SERIES (key ), VAL_INDEX (key ), VAL_LEN (key ));
259
+ VAL_TYPE (set ) = VAL_TYPE (key );
254
260
} else {
255
261
Append_Val (series , key );
256
262
}
257
263
#else
258
- Append_Val (series , key );
264
+ if (ANY_BINSTR (key ) && !IS_LOCK_SERIES (VAL_SERIES (key ))) {
265
+ // copy the key if it is any-series (except when it is permanently locked)
266
+ set = Append_Value (series );
267
+ VAL_SERIES (set ) = Copy_String (VAL_SERIES (key ), VAL_INDEX (key ), VAL_LEN (key ));
268
+ VAL_TYPE (set ) = VAL_TYPE (key );
269
+ } else {
270
+ Append_Val (series , key );
271
+ }
259
272
#endif
260
273
// append value
261
274
Append_Val (series , val ); // no Copy_Series_Value(val) on strings
Original file line number Diff line number Diff line change @@ -58,6 +58,18 @@ Rebol [
58
58
n: copy/deep m
59
59
--assert not same? n/b m/b
60
60
61
+ ;@@ https://github.com/Oldes/Rebol-issues/issues/2220
62
+ --test-- "map-issue-2220"
63
+ ; using at least 8 keys (initial map implemention was using internally block for small maps)
64
+ keys: ["a" #{} #{ 00 } a@b http://a http://b %file1 %file2 ]
65
+ m: map collect [repeat i 8 [keep keys/: i keep i]]
66
+ --assert keys = keys-of m
67
+ repeat i 8 [
68
+ --assert i = select m keys/: i
69
+ append keys/: i #"X"
70
+ --assert none? select m keys/: i
71
+ ]
72
+
61
73
===end-group===
62
74
63
75
You can’t perform that action at this time.
0 commit comments