diff options
author | krolik <krolik@kologlobal.com> | 2015-03-05 14:43:15 +0200 |
---|---|---|
committer | krolik <krolik@kologlobal.com> | 2015-03-05 14:43:15 +0200 |
commit | 4fe0a725771db48475fd8da191c24f51fef16ab8 (patch) | |
tree | 9f9b59e0d676cf9e0df6a5b26b157c59d2b3e8e0 /lib/pure/collections/tables.nim | |
parent | 70d0894ace2f93e459be0c2caf59748dec9b0ef2 (diff) | |
download | Nim-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.nim | 6 |
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`. |