diff options
author | Araq <rumpf_a@web.de> | 2014-09-11 00:34:59 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-09-11 00:34:59 +0200 |
commit | 2c99991d169d66d5fd2334cfc783761d1ffe25bc (patch) | |
tree | 1532d954d0ad9fc2aee117692a59459892ebbe91 /lib | |
parent | dcc00b3960d67ec03414d02a8958335caaa5f22b (diff) | |
download | Nim-2c99991d169d66d5fd2334cfc783761d1ffe25bc.tar.gz |
fixes #1444
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/collections/sets.nim | 2 | ||||
-rw-r--r-- | lib/system.nim | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/pure/collections/sets.nim b/lib/pure/collections/sets.nim index 22eff9c55..ce901963e 100644 --- a/lib/pure/collections/sets.nim +++ b/lib/pure/collections/sets.nim @@ -128,7 +128,7 @@ proc mget*[A](s: var TSet[A], key: A): var A = ## for sharing. assert s.isValid, "The set needs to be initialized." var index = rawGet(s, key) - if index >= 0: result = t.data[index].key + if index >= 0: result = s.data[index].key else: raise newException(EInvalidKey, "key not found: " & $key) proc contains*[A](s: TSet[A], key: A): bool = diff --git a/lib/system.nim b/lib/system.nim index 0d8f63bd4..0df8849f5 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -849,13 +849,13 @@ proc contains*[T](s: TSlice[T], value: T): bool {.noSideEffect, inline.} = ## assert((1..3).contains(4) == false) result = s.a <= value and value <= s.b -template `in` * (x, y: expr): expr {.immediate.} = contains(y, x) +template `in` * (x, y: expr): expr {.immediate, dirty.} = contains(y, x) ## Sugar for contains ## ## .. code-block:: Nimrod ## assert(1 in (1..3) == true) ## assert(5 in (1..3) == false) -template `notin` * (x, y: expr): expr {.immediate.} = not contains(y, x) +template `notin` * (x, y: expr): expr {.immediate, dirty.} = not contains(y, x) ## Sugar for not containing ## ## .. code-block:: Nimrod |