summary refs log tree commit diff stats
path: root/lib/pure/collections/tables.nim
diff options
context:
space:
mode:
authorkrolik <krolik@kologlobal.com>2015-03-05 14:43:15 +0200
committerkrolik <krolik@kologlobal.com>2015-03-05 14:43:15 +0200
commit4fe0a725771db48475fd8da191c24f51fef16ab8 (patch)
tree9f9b59e0d676cf9e0df6a5b26b157c59d2b3e8e0 /lib/pure/collections/tables.nim
parent70d0894ace2f93e459be0c2caf59748dec9b0ef2 (diff)
downloadNim-4fe0a725771db48475fd8da191c24f51fef16ab8.tar.gz
Fixed table getter not compiling when table value type had not '$' proc overriden
Diffstat (limited to 'lib/pure/collections/tables.nim')
-rw-r--r--lib/pure/collections/tables.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim
index 959688d6a..93a7591ac 100644
--- a/lib/pure/collections/tables.nim
+++ b/lib/pure/collections/tables.nim
@@ -196,7 +196,11 @@ proc mget*[A, B](t: var Table[A, B], key: A): var B =
   var hc: THash
   var index = rawGet(t, key, hc)
   if index >= 0: result = t.data[index].val
-  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")
 
 iterator allValues*[A, B](t: Table[A, B]; key: A): B =
   ## iterates over any value in the table `t` that belongs to the given `key`.