summary refs log tree commit diff stats
path: root/lib/pure/collections
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-11-05 19:05:02 +0800
committerGitHub <noreply@github.com>2022-11-05 12:05:02 +0100
commit92e525d2a6b1524b25f62b3b76e9e4df0120ba24 (patch)
tree6c79934724d50a39da0eceebfac1f9f14635358f /lib/pure/collections
parent4b24d85907f4e5a77d43718072f943cf00c3d646 (diff)
downloadNim-92e525d2a6b1524b25f62b3b76e9e4df0120ba24.tar.gz
add effectsOf to map in the std/sets module (#20760)
Diffstat (limited to 'lib/pure/collections')
-rw-r--r--lib/pure/collections/sets.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/pure/collections/sets.nim b/lib/pure/collections/sets.nim
index 114e4582a..09648ea65 100644
--- a/lib/pure/collections/sets.nim
+++ b/lib/pure/collections/sets.nim
@@ -50,6 +50,9 @@
 import
   hashes, math
 
+when not defined(nimHasEffectsOf):
+  {.pragma: effectsOf.}
+
 {.pragma: myShallow.}
 # For "integer-like A" that are too big for intsets/bit-vectors to be practical,
 # it would be best to shrink hcode to the same size as the integer.  Larger
@@ -556,7 +559,7 @@ proc `==`*[A](s, t: HashSet[A]): bool =
 
   s.counter == t.counter and s <= t
 
-proc map*[A, B](data: HashSet[A], op: proc (x: A): B {.closure.}): HashSet[B] =
+proc map*[A, B](data: HashSet[A], op: proc (x: A): B {.closure.}): HashSet[B] {.effectsOf: op.} =
   ## Returns a new set after applying `op` proc on each of the elements of
   ##`data` set.
   ##