Don't expect all keys in hashsets to have $ defined

This commit is contained in:
Samantha Doran 2016-03-01 11:23:47 -05:00
commit d732279203

View file

@ -163,7 +163,11 @@ proc `[]`*[A](s: var HashSet[A], key: A): var A =
var hc: Hash var hc: Hash
var index = rawGet(s, key, hc) var index = rawGet(s, key, hc)
if index >= 0: result = s.data[index].key 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.} = 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 ## returns the element that is actually stored in 's' which has the same