diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-06-02 22:03:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-02 16:03:32 +0200 |
commit | 1133f20fe2c834d14454c32d7d9fc2cd1fe8ffa2 (patch) | |
tree | 6eb03f314132d5022d6ebfdc7d4b706dfa8cfb5f /tests/arc | |
parent | ead7e20926b1f5ea1b06679947d3d16fcc085e68 (diff) | |
download | Nim-1133f20fe2c834d14454c32d7d9fc2cd1fe8ffa2.tar.gz |
lift the `=dup` hook (#21903)
* fixes tests again * remove helper functions * fixes closures, owned refs * final cleanup
Diffstat (limited to 'tests/arc')
-rw-r--r-- | tests/arc/tdup.nim | 7 | ||||
-rw-r--r-- | tests/arc/topt_no_cursor.nim | 15 | ||||
-rw-r--r-- | tests/arc/topt_wasmoved_destroy_pairs.nim | 3 |
3 files changed, 10 insertions, 15 deletions
diff --git a/tests/arc/tdup.nim b/tests/arc/tdup.nim index b77f5c6eb..61f262a68 100644 --- a/tests/arc/tdup.nim +++ b/tests/arc/tdup.nim @@ -18,7 +18,7 @@ inc: var id_1 = 777 s = RefCustom(id_2: addr(id_1)) inc_1 : - :tmpD_1 = `=dup`(s) + :tmpD_1 = `=dup_1`(s) :tmpD_1 inc_1 : let blitTmp_1 = s @@ -34,14 +34,15 @@ type RefCustom = object id: ptr int +proc `=dup`(x: RefCustom): RefCustom = + result.id = x.id + proc inc(x: sink Ref) = inc x.id proc inc(x: sink RefCustom) = inc x.id[] -proc `=dup`(x: RefCustom): RefCustom = - result.id = x.id proc foo = var x = Ref(id: 8) diff --git a/tests/arc/topt_no_cursor.nim b/tests/arc/topt_no_cursor.nim index 32652b60a..39e5c8a9b 100644 --- a/tests/arc/topt_no_cursor.nim +++ b/tests/arc/topt_no_cursor.nim @@ -61,11 +61,9 @@ var try: it_cursor = x a = ( - `=wasMoved`(:tmpD) - `=copy`(:tmpD, it_cursor.key) + :tmpD = `=dup`(it_cursor.key) :tmpD, - `=wasMoved`(:tmpD_1) - `=copy`(:tmpD_1, it_cursor.val) + :tmpD_1 = `=dup`(it_cursor.val) :tmpD_1) echo [ :tmpD_2 = `$$`(a) @@ -125,19 +123,16 @@ this.isValid = fileExists(this.value) if dirExists(this.value): var :tmpD par = (dir: - `=wasMoved`(:tmpD) - `=copy`(:tmpD, this.value) + :tmpD = `=dup`(this.value) :tmpD, front: "") else: var :tmpD_1 :tmpD_2 :tmpD_3 par = (dir_1: parentDir(this.value), front_1: - `=wasMoved`(:tmpD_1) - `=copy`(:tmpD_1, + :tmpD_1 = `=dup`( :tmpD_3 = splitDrive do: - `=wasMoved`(:tmpD_2) - `=copy`(:tmpD_2, this.value) + :tmpD_2 = `=dup`(this.value) :tmpD_2 :tmpD_3.path) :tmpD_1) diff --git a/tests/arc/topt_wasmoved_destroy_pairs.nim b/tests/arc/topt_wasmoved_destroy_pairs.nim index 6577d6787..c96340a30 100644 --- a/tests/arc/topt_wasmoved_destroy_pairs.nim +++ b/tests/arc/topt_wasmoved_destroy_pairs.nim @@ -39,8 +39,7 @@ try: if i_cursor == 2: return add(a): - `=wasMoved`(:tmpD) - `=copy`(:tmpD, x) + :tmpD = `=dup`(x) :tmpD inc i_1, 1 if cond: |