Merge pull request #3923 from samanthadoran/devel

Don't expect all keys in hashsets to have $ defined
This commit is contained in:
Dennis Felsing
2016-03-01 17:31:18 +01:00

View File

@@ -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