Skip to content

Commit 482662d

Browse files
authored
fixes #24721; Table add missing sink (#24724)
fixes #24721
1 parent 9ace1f9 commit 482662d

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/pure/collections/tableimpl.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ proc rawGetDeep[X, A](t: X, key: A, hc: var Hash): int {.inline, outParamsAt: [3
3030
rawGetDeepImpl()
3131

3232
proc rawInsert[X, A, B](t: var X, data: var KeyValuePairSeq[A, B],
33-
key: A, val: sink B, hc: Hash, h: Hash) =
33+
key: sink A, val: sink B, hc: Hash, h: Hash) =
3434
rawInsertImpl()
3535
3636
template checkIfInitialized() =

lib/pure/collections/tables.nim

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ proc initTable*[A, B](initialSize = defaultInitialSize): Table[A, B] =
281281
result = default(Table[A, B])
282282
initImpl(result, initialSize)
283283

284-
proc `[]=`*[A, B](t: var Table[A, B], key: A, val: sink B) =
284+
proc `[]=`*[A, B](t: var Table[A, B], key: sink A, val: sink B) =
285285
## Inserts a `(key, value)` pair into `t`.
286286
##
287287
## See also:
@@ -494,7 +494,7 @@ proc len*[A, B](t: Table[A, B]): int =
494494
495495
result = t.counter
496496
497-
proc add*[A, B](t: var Table[A, B], key: A, val: sink B) {.deprecated:
497+
proc add*[A, B](t: var Table[A, B], key: sink A, val: sink B) {.deprecated:
498498
"Deprecated since v1.4; it was more confusing than useful, use `[]=`".} =
499499
## Puts a new `(key, value)` pair into `t` even if `t[key]` already exists.
500500
##
@@ -888,7 +888,7 @@ proc `[]`*[A, B](t: TableRef[A, B], key: A): var B =
888888

889889
result = t[][key]
890890

891-
proc `[]=`*[A, B](t: TableRef[A, B], key: A, val: sink B) =
891+
proc `[]=`*[A, B](t: TableRef[A, B], key: sink A, val: sink B) =
892892
## Inserts a `(key, value)` pair into `t`.
893893
##
894894
## See also:
@@ -1045,7 +1045,7 @@ proc len*[A, B](t: TableRef[A, B]): int =
10451045
10461046
result = t.counter
10471047
1048-
proc add*[A, B](t: TableRef[A, B], key: A, val: sink B) {.deprecated:
1048+
proc add*[A, B](t: TableRef[A, B], key: sink A, val: sink B) {.deprecated:
10491049
"Deprecated since v1.4; it was more confusing than useful, use `[]=`".} =
10501050
## Puts a new `(key, value)` pair into `t` even if `t[key]` already exists.
10511051
##
@@ -1297,7 +1297,7 @@ proc rawGet[A, B](t: OrderedTable[A, B], key: A, hc: var Hash): int =
12971297
12981298
proc rawInsert[A, B](t: var OrderedTable[A, B],
12991299
data: var OrderedKeyValuePairSeq[A, B],
1300-
key: A, val: sink B, hc: Hash, h: Hash) =
1300+
key: sink A, val: sink B, hc: Hash, h: Hash) =
13011301
rawInsertImpl()
13021302
data[h].next = -1
13031303
if t.first < 0: t.first = h
@@ -1349,7 +1349,7 @@ proc initOrderedTable*[A, B](initialSize = defaultInitialSize): OrderedTable[A,
13491349
result = default(OrderedTable[A, B])
13501350
initImpl(result, initialSize)
13511351

1352-
proc `[]=`*[A, B](t: var OrderedTable[A, B], key: A, val: sink B) =
1352+
proc `[]=`*[A, B](t: var OrderedTable[A, B], key: sink A, val: sink B) =
13531353
## Inserts a `(key, value)` pair into `t`.
13541354
##
13551355
## See also:
@@ -1547,7 +1547,7 @@ proc len*[A, B](t: OrderedTable[A, B]): int {.inline.} =
15471547
15481548
result = t.counter
15491549
1550-
proc add*[A, B](t: var OrderedTable[A, B], key: A, val: sink B) {.deprecated:
1550+
proc add*[A, B](t: var OrderedTable[A, B], key: sink A, val: sink B) {.deprecated:
15511551
"Deprecated since v1.4; it was more confusing than useful, use `[]=`".} =
15521552
## Puts a new `(key, value)` pair into `t` even if `t[key]` already exists.
15531553
##
@@ -1907,7 +1907,7 @@ proc `[]`*[A, B](t: OrderedTableRef[A, B], key: A): var B =
19071907
echo a['z']
19081908
result = t[][key]
19091909

1910-
proc `[]=`*[A, B](t: OrderedTableRef[A, B], key: A, val: sink B) =
1910+
proc `[]=`*[A, B](t: OrderedTableRef[A, B], key: sink A, val: sink B) =
19111911
## Inserts a `(key, value)` pair into `t`.
19121912
##
19131913
## See also:
@@ -2048,7 +2048,7 @@ proc len*[A, B](t: OrderedTableRef[A, B]): int {.inline.} =
20482048
20492049
result = t.counter
20502050
2051-
proc add*[A, B](t: OrderedTableRef[A, B], key: A, val: sink B) {.deprecated:
2051+
proc add*[A, B](t: OrderedTableRef[A, B], key: sink A, val: sink B) {.deprecated:
20522052
"Deprecated since v1.4; it was more confusing than useful, use `[]=`".} =
20532053
## Puts a new `(key, value)` pair into `t` even if `t[key]` already exists.
20542054
##

0 commit comments

Comments
 (0)