Properly handle tombstones when inserting items into a map.

Previously, you could get into a state where a key was present in the
map, but after a tombstone in the probe sequence. If they key was added
again, it stopped at the first tombstone and added it there, resulting
in the key being in the map multiple times.

Fix #373.
This commit is contained in:
Bob Nystrom
2016-06-27 07:14:52 -07:00
parent bc29f43bbd
commit 4e94195f26
2 changed files with 96 additions and 65 deletions

View File

@ -0,0 +1,9 @@
// Regression test for #373.
var map = {}
map[2] = "two"
map[0] = "zero"
map.remove(2)
map[0] = "zero again"
map.remove(0)
System.print(map.containsKey(0)) // expect: false