mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-18 13:49:59 +01:00
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:
9
test/core/map/reuse_tombstone.wren
Normal file
9
test/core/map/reuse_tombstone.wren
Normal 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
|
||||
Reference in New Issue
Block a user