summary refs log tree commit diff stats
path: root/tests/arc
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2022-10-17 23:48:51 +0200
committerGitHub <noreply@github.com>2022-10-17 23:48:51 +0200
commit81087c949f620dc80697364da414872791ffe23c (patch)
tree870c578d221484861f485371ebde2fca18d6ca08 /tests/arc
parentc0824b9b80f50807fc41b621760c4b685d1d7497 (diff)
downloadNim-81087c949f620dc80697364da414872791ffe23c.tar.gz
fixes #20572 (#20585)
* fixes #20572

* added a test case
Diffstat (limited to 'tests/arc')
-rw-r--r--tests/arc/texplicit_sink.nim29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/arc/texplicit_sink.nim b/tests/arc/texplicit_sink.nim
new file mode 100644
index 000000000..4b021ed62
--- /dev/null
+++ b/tests/arc/texplicit_sink.nim
@@ -0,0 +1,29 @@
+discard """
+  output: '''de'''
+  cmd: '''nim c --mm:arc --expandArc:main $file'''
+  nimout: '''--expandArc: main
+
+var
+  a
+  b_cursor
+try:
+  a = f "abc"
+  b_cursor = "de"
+  `=sink`(a, b_cursor)
+  echo [a]
+finally:
+  `=destroy`(a)
+-- end of expandArc ------------------------'''
+"""
+
+# bug #20572
+
+proc f(s: string): string = s
+
+proc main =
+  var a = f "abc"
+  var b = "de"
+  `=sink`(a, b)
+  echo a
+
+main()