Deleting specific keys from ordered table leaves it in invalid state. #5057

Closed
yglukhov opened this Issue Nov 25, 2016 · 1 comment

Projects

None yet

1 participant

@yglukhov
Member
import tables

# The bug is reproducible only with exact keys
const key1 = "boy_jackpot.inGamma"
const key2 = "boy_jackpot.outBlack"

var t = {
    key1: 0,
    key2: 0
}.toOrderedTable()

assert(key2 in t) # Passes
t.del(key1)
echo t # Prints {boy_jackpot.outBlack: 0}
assert(key2 in t) # Fails

Arch: amd64. This is not a recent regression. More likely the bug existed since i've first introduced del for OrderedTable.

@yglukhov
Member

Looks like del impl for OrderedTable is flawed because it doesn't account for collision clusters.

@Araq Araq pushed a commit that closed this issue Nov 27, 2016
@yglukhov yglukhov Fixes #5057 4120549
@Araq Araq closed this in 4120549 Nov 27, 2016
@yglukhov yglukhov added a commit to yglukhov/Nim that referenced this issue Nov 27, 2016
@yglukhov yglukhov Corrected test case for #5057. 10292a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment