File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 128
128
// Compute hash for value:
129
129
len = hser -> tail ;
130
130
hash = Hash_Value (key , len );
131
- if (!hash ) Trap_Type (key );
131
+ //o: use fallback hash value, if key is not a hashable type, instead of an error
132
+ //o: https://github.com/Oldes/Rebol-issues/issues/1765
133
+ if (!hash ) hash = 3 * (len /5 ); //Trap_Type(key);
132
134
133
135
// Determine skip and first index:
134
136
skip = (len == 0 ) ? 0 : (hash & 0x0000FFFF ) % len ;
Original file line number Diff line number Diff line change @@ -1345,6 +1345,20 @@ Rebol [
1345
1345
1346
1346
===end-group===
1347
1347
1348
+ ===start-group=== "More set operations"
1349
+ --test-- "unhashable types"
1350
+ ;@@ https://github.com/Oldes/Rebol-issues/issues/1765
1351
+ blk1: reduce ["a" [1 2 3 ] 'path/path func [][] charset ["a" ]]
1352
+ blk2: append copy blk1 blk1
1353
+ --assert blk1 = unique blk2
1354
+ --assert blk1 = union blk1 blk2
1355
+ append blk2 blk3: ["b" [3 4 ]]
1356
+ --assert blk1 = intersect blk2 blk1
1357
+ --assert blk3 = difference blk1 blk2
1358
+ --assert blk3 = exclude blk2 blk1
1359
+ --assert empty? exclude blk1 blk2
1360
+ ===end-group===
1361
+
1348
1362
===start-group=== "TO-*"
1349
1363
1350
1364
--test-- "to-path"
You can’t perform that action at this time.
0 commit comments