fixes hash(HashSet) which was wrong as it didn't respect tombstones; refs #13649

This commit is contained in:
Araq
2020-03-18 10:47:46 +01:00
parent 5f6997794e
commit 3f1a85b7f0

View File

@@ -574,7 +574,8 @@ proc map*[A, B](data: HashSet[A], op: proc (x: A): B {.closure.}): HashSet[B] =
proc hash*[A](s: HashSet[A]): Hash =
## Hashing of HashSet.
for h in 0 .. high(s.data):
result = result xor s.data[h].hcode
if isFilledAndValid(s.data[h].hcode):
result = result xor s.data[h].hcode
result = !$result
proc `$`*[A](s: HashSet[A]): string =