From 3f1a85b7f03a4998f09a4fe6e8bf13672742fcb9 Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 18 Mar 2020 10:47:46 +0100 Subject: [PATCH] fixes hash(HashSet) which was wrong as it didn't respect tombstones; refs #13649 --- lib/pure/collections/sets.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pure/collections/sets.nim b/lib/pure/collections/sets.nim index 9f800e6d1f..caa25dbb31 100644 --- a/lib/pure/collections/sets.nim +++ b/lib/pure/collections/sets.nim @@ -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 =