From 58f1e22db352ed3cff0f9303acf064a291c25d8d Mon Sep 17 00:00:00 2001 From: narimiran Date: Mon, 3 Mar 2025 20:32:56 +0100 Subject: [PATCH] Revert "sink tuples by values (#24731)" This reverts commit b9d3348dabe446bf15c4d91517bafa3d1ec80795. --- compiler/ccgutils.nim | 6 +----- tests/arc/tarcmisc.nim | 16 ---------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/compiler/ccgutils.nim b/compiler/ccgutils.nim index 1b75906909..d0efc20bd2 100644 --- a/compiler/ccgutils.nim +++ b/compiler/ccgutils.nim @@ -101,11 +101,7 @@ proc ccgIntroducedPtr*(conf: ConfigRef; s: PSym, retType: PType): bool = result = true # ordinary objects are always passed by reference, # otherwise casting doesn't work of tyTuple: - if s.typ.kind == tySink: - # it's a sink, so we pass it by value - result = false - else: - result = (getSize(conf, pt) > conf.target.floatSize*3) or (optByRef in s.options) + result = (getSize(conf, pt) > conf.target.floatSize*3) or (optByRef in s.options) else: result = false # first parameter and return type is 'lent T'? --> use pass by pointer diff --git a/tests/arc/tarcmisc.nim b/tests/arc/tarcmisc.nim index 12d67a999b..6b8fc3b06f 100644 --- a/tests/arc/tarcmisc.nim +++ b/tests/arc/tarcmisc.nim @@ -33,7 +33,6 @@ copying 123 42 @["", "d", ""] -mutate: 1 ok destroying variable: 20 destroying variable: 10 @@ -883,18 +882,3 @@ proc test_18070() = # bug #18070 doAssert msg == "", "expected empty string but got: " & $msg test_18070() - -type AnObject = tuple - a: string - b: int - c: int - -proc mutate(a: sink AnObject) = - `=wasMoved`(a) - echo "mutate: 1" - -# echo "Value is: ", obj.value -proc bar = - mutate(("1.2", 0, 0)) - -bar()