breaking change: symbol lookups in generics follows spec more closely; fixes #2664
This commit is contained in:
parent
2e4b59f3d3
commit
c733b3181e
4 changed files with 88 additions and 65 deletions
|
|
@ -226,6 +226,10 @@ proc `$`*[A, B](t: Table[A, B]): string =
|
|||
## The `$` operator for hash tables.
|
||||
dollarImpl()
|
||||
|
||||
proc hasKey*[A, B](t: TableRef[A, B], key: A): bool =
|
||||
## returns true iff `key` is in the table `t`.
|
||||
result = t[].hasKey(key)
|
||||
|
||||
template equalsImpl() =
|
||||
if s.counter == t.counter:
|
||||
# different insertion orders mean different 'data' seqs, so we have
|
||||
|
|
@ -293,10 +297,6 @@ proc hasKeyOrPut*[A, B](t: var TableRef[A, B], key: A, val: B): bool =
|
|||
## returns true iff `key` is in the table, otherwise inserts `value`.
|
||||
t[].hasKeyOrPut(key, val)
|
||||
|
||||
proc hasKey*[A, B](t: TableRef[A, B], key: A): bool =
|
||||
## returns true iff `key` is in the table `t`.
|
||||
result = t[].hasKey(key)
|
||||
|
||||
proc contains*[A, B](t: TableRef[A, B], key: A): bool =
|
||||
## alias of `hasKey` for use with the `in` operator.
|
||||
return hasKey[A, B](t, key)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue