summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorSamantha Doran <samanthadoran3@gmail.com>2016-03-01 11:23:47 -0500
committerSamantha Doran <samanthadoran3@gmail.com>2016-03-01 11:23:47 -0500
commitd73227920365dcd3f0e58db561bf0934f33e7259 (patch)
tree1946dcc7b9dfc5c9cfe85a4a69c916d618897524 /lib/pure
parent232d042731589335f65ca3b5d6b41faf2df42ba4 (diff)
downloadNim-d73227920365dcd3f0e58db561bf0934f33e7259.tar.gz
Don't expect all keys in hashsets to have $ defined
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