Commit d1fd5a3
committed
Fix HashDict so that key comparison uses exact match
This change means that HashDict buckets are nolonger strictly ordered.
Previously keys which compared equal (==) but not exactly equal (===)
would be considered different for large sizes but equivalent for small
sizes. This ambiguity occured because hashes are only equal when terms
are exactly equal (===), so both now use exact (===) key comparisons.
Small HashDicts are still a single ordered list and large HashDicts
contain ordered buckets. Both of these may contain keys that compare
equal (==) but are not exactly equal (===), should these keys be present
in the same list or bucket the ordering of these keys (relative to each
other) is undefined.
See github issue #1171 for examples.
Note: If assumptions were made about the form of a HashDict they may
nolonger be valid. Particularly that HashDicts can nolonger be reliably
pattern matched on for equality.1 parent a3aa1e8 commit d1fd5a3
File tree
4 files changed
+93
-51
lines changed- lib/elixir
- lib
- test/elixir
4 files changed
+93
-51
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
230 | 220 | | |
231 | 221 | | |
232 | 222 | | |
| |||
237 | 227 | | |
238 | 228 | | |
239 | 229 | | |
240 | | - | |
| 230 | + | |
241 | 231 | | |
242 | 232 | | |
243 | 233 | | |
| |||
335 | 325 | | |
336 | 326 | | |
337 | 327 | | |
338 | | - | |
| 328 | + | |
339 | 329 | | |
340 | 330 | | |
341 | 331 | | |
342 | | - | |
| 332 | + | |
343 | 333 | | |
344 | 334 | | |
345 | 335 | | |
| |||
402 | 392 | | |
403 | 393 | | |
404 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
405 | 414 | | |
406 | 415 | | |
407 | | - | |
408 | | - | |
409 | | - | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
410 | 419 | | |
411 | 420 | | |
412 | | - | |
413 | | - | |
| 421 | + | |
| 422 | + | |
414 | 423 | | |
415 | 424 | | |
416 | | - | |
417 | | - | |
418 | | - | |
| 425 | + | |
| 426 | + | |
419 | 427 | | |
420 | 428 | | |
421 | | - | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
422 | 443 | | |
423 | 444 | | |
424 | 445 | | |
425 | | - | |
426 | | - | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
427 | 453 | | |
428 | 454 | | |
429 | 455 | | |
| |||
436 | 462 | | |
437 | 463 | | |
438 | 464 | | |
439 | | - | |
440 | | - | |
441 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
442 | 468 | | |
443 | 469 | | |
444 | 470 | | |
445 | | - | |
| 471 | + | |
446 | 472 | | |
447 | 473 | | |
448 | 474 | | |
449 | | - | |
450 | | - | |
451 | | - | |
| 475 | + | |
| 476 | + | |
452 | 477 | | |
453 | 478 | | |
454 | | - | |
455 | | - | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
456 | 482 | | |
457 | 483 | | |
458 | 484 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| |||
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
85 | 101 | | |
86 | 102 | | |
87 | 103 | | |
| |||
95 | 111 | | |
96 | 112 | | |
97 | 113 | | |
98 | | - | |
| 114 | + | |
99 | 115 | | |
100 | 116 | | |
101 | 117 | | |
102 | 118 | | |
103 | 119 | | |
104 | | - | |
| 120 | + | |
105 | 121 | | |
106 | 122 | | |
107 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
0 commit comments