summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/collections/sets.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/pure/collections/sets.nim b/lib/pure/collections/sets.nim
index 9a42a21ee..aa4919884 100644
--- a/lib/pure/collections/sets.nim
+++ b/lib/pure/collections/sets.nim
@@ -163,7 +163,11 @@ proc `[]`*[A](s: var HashSet[A], key: A): var A =
   var hc: Hash
   var index = rawGet(s, key, hc)
   if index >= 0: result = s.data[index].key
-  else: raise newException(KeyError, "key not found: " & $key)
+  else:
+    when compiles($key):
+      raise newException(KeyError, "key not found: " & $key)
+    else:
+      raise newException(KeyError, "key not found")
 
 proc mget*[A](s: var HashSet[A], key: A): var A {.deprecated.} =
   ## returns the element that is actually stored in 's' which has the same