fixes #24721; Table add missing sink (#24724)

fixes #24721

(cherry picked from commit 482662d198)
This commit is contained in:
ringabout
2025-03-23 05:48:21 +08:00
committed by narimiran
parent e799d2fca0
commit 20362cc0d2
2 changed files with 10 additions and 10 deletions

View File

@@ -30,7 +30,7 @@ proc rawGetDeep[X, A](t: X, key: A, hc: var Hash): int {.inline, outParamsAt: [3
rawGetDeepImpl()
proc rawInsert[X, A, B](t: var X, data: var KeyValuePairSeq[A, B],
key: A, val: sink B, hc: Hash, h: Hash) =
key: sink A, val: sink B, hc: Hash, h: Hash) =
rawInsertImpl()
template checkIfInitialized() =

View File

@@ -281,7 +281,7 @@ proc initTable*[A, B](initialSize = defaultInitialSize): Table[A, B] =
result = default(Table[A, B])
initImpl(result, initialSize)
proc `[]=`*[A, B](t: var Table[A, B], key: A, val: sink B) =
proc `[]=`*[A, B](t: var Table[A, B], key: sink A, val: sink B) =
## Inserts a `(key, value)` pair into `t`.
##
## See also:
@@ -494,7 +494,7 @@ proc len*[A, B](t: Table[A, B]): int =
result = t.counter
proc add*[A, B](t: var Table[A, B], key: A, val: sink B) {.deprecated:
proc add*[A, B](t: var Table[A, B], key: sink A, val: sink B) {.deprecated:
"Deprecated since v1.4; it was more confusing than useful, use `[]=`".} =
## Puts a new `(key, value)` pair into `t` even if `t[key]` already exists.
##
@@ -888,7 +888,7 @@ proc `[]`*[A, B](t: TableRef[A, B], key: A): var B =
result = t[][key]
proc `[]=`*[A, B](t: TableRef[A, B], key: A, val: sink B) =
proc `[]=`*[A, B](t: TableRef[A, B], key: sink A, val: sink B) =
## Inserts a `(key, value)` pair into `t`.
##
## See also:
@@ -1045,7 +1045,7 @@ proc len*[A, B](t: TableRef[A, B]): int =
result = t.counter
proc add*[A, B](t: TableRef[A, B], key: A, val: sink B) {.deprecated:
proc add*[A, B](t: TableRef[A, B], key: sink A, val: sink B) {.deprecated:
"Deprecated since v1.4; it was more confusing than useful, use `[]=`".} =
## Puts a new `(key, value)` pair into `t` even if `t[key]` already exists.
##
@@ -1297,7 +1297,7 @@ proc rawGet[A, B](t: OrderedTable[A, B], key: A, hc: var Hash): int =
proc rawInsert[A, B](t: var OrderedTable[A, B],
data: var OrderedKeyValuePairSeq[A, B],
key: A, val: sink B, hc: Hash, h: Hash) =
key: sink A, val: sink B, hc: Hash, h: Hash) =
rawInsertImpl()
data[h].next = -1
if t.first < 0: t.first = h
@@ -1349,7 +1349,7 @@ proc initOrderedTable*[A, B](initialSize = defaultInitialSize): OrderedTable[A,
result = default(OrderedTable[A, B])
initImpl(result, initialSize)
proc `[]=`*[A, B](t: var OrderedTable[A, B], key: A, val: sink B) =
proc `[]=`*[A, B](t: var OrderedTable[A, B], key: sink A, val: sink B) =
## Inserts a `(key, value)` pair into `t`.
##
## See also:
@@ -1547,7 +1547,7 @@ proc len*[A, B](t: OrderedTable[A, B]): int {.inline.} =
result = t.counter
proc add*[A, B](t: var OrderedTable[A, B], key: A, val: sink B) {.deprecated:
proc add*[A, B](t: var OrderedTable[A, B], key: sink A, val: sink B) {.deprecated:
"Deprecated since v1.4; it was more confusing than useful, use `[]=`".} =
## Puts a new `(key, value)` pair into `t` even if `t[key]` already exists.
##
@@ -1907,7 +1907,7 @@ proc `[]`*[A, B](t: OrderedTableRef[A, B], key: A): var B =
echo a['z']
result = t[][key]
proc `[]=`*[A, B](t: OrderedTableRef[A, B], key: A, val: sink B) =
proc `[]=`*[A, B](t: OrderedTableRef[A, B], key: sink A, val: sink B) =
## Inserts a `(key, value)` pair into `t`.
##
## See also:
@@ -2048,7 +2048,7 @@ proc len*[A, B](t: OrderedTableRef[A, B]): int {.inline.} =
result = t.counter
proc add*[A, B](t: OrderedTableRef[A, B], key: A, val: sink B) {.deprecated:
proc add*[A, B](t: OrderedTableRef[A, B], key: sink A, val: sink B) {.deprecated:
"Deprecated since v1.4; it was more confusing than useful, use `[]=`".} =
## Puts a new `(key, value)` pair into `t` even if `t[key]` already exists.
##