summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-10-09 14:48:42 +0200
committerGitHub <noreply@github.com>2019-10-09 14:48:42 +0200
commitf728614ef8d47ad2ed92eb71dc39d5d0fc83671d (patch)
tree424bff9f21281955a230e0cc6b5d9cfa4fe5eed8
parent82fe19769ab7c796b82110c05e1a6b2d77648971 (diff)
downloadNim-f728614ef8d47ad2ed92eb71dc39d5d0fc83671d.tar.gz
fixes #12366 [backport] (#12393)
-rw-r--r--lib/pure/collections/intsets.nim17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/pure/collections/intsets.nim b/lib/pure/collections/intsets.nim
index 8b7703804..8338ceaca 100644
--- a/lib/pure/collections/intsets.nim
+++ b/lib/pure/collections/intsets.nim
@@ -387,6 +387,7 @@ proc assign*(dest: var IntSet, src: IntSet) =
   else:
     dest.counter = src.counter
     dest.max = src.max
+    dest.elems = src.elems
     newSeq(dest.data, src.data.len)
 
     var it = src.head
@@ -653,3 +654,19 @@ when isMainModule:
   xs = toSeq(items(x))
   xs.sort(cmp[int])
   assert xs == @[1, 4, 7, 1001, 1056]
+
+  proc bug12366 =
+    var
+      x = initIntSet()
+      y = initIntSet()
+      n = 3584
+
+    for i in 0..n:
+      x.incl(i)
+      y.incl(i)
+
+    let z = symmetricDifference(x, y)
+    doAssert z.len == 0
+    doAssert $z == "{}"
+
+  bug12366()