diff options
author | Samantha Doran <samanthadoran3@gmail.com> | 2016-03-01 11:23:47 -0500 |
---|---|---|
committer | Samantha Doran <samanthadoran3@gmail.com> | 2016-03-01 11:23:47 -0500 |
commit | d73227920365dcd3f0e58db561bf0934f33e7259 (patch) | |
tree | 1946dcc7b9dfc5c9cfe85a4a69c916d618897524 /lib/pure | |
parent | 232d042731589335f65ca3b5d6b41faf2df42ba4 (diff) | |
download | Nim-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.nim | 6 |
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 |