summary refs log tree commit diff stats
path: root/tests/arc/tarcmisc.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-07-04 07:37:24 +0200
committerGitHub <noreply@github.com>2020-07-04 07:37:24 +0200
commit1854d29781aff913ca6892cbf73df91b0399397e (patch)
tree4a71bc7988c753ef1acab28776edec691c6d27bd /tests/arc/tarcmisc.nim
parent695154970d839add2fbbe9754e9e638511120729 (diff)
downloadNim-1854d29781aff913ca6892cbf73df91b0399397e.tar.gz
scoped memory management (#14790)
* fixes the regressions
* closes #13936
* scope based memory management implemented
* enabled tcontrolflow.nim test case
* final cleanups
Diffstat (limited to 'tests/arc/tarcmisc.nim')
-rw-r--r--tests/arc/tarcmisc.nim36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/arc/tarcmisc.nim b/tests/arc/tarcmisc.nim
index 898efd138..e66d9a75f 100644
--- a/tests/arc/tarcmisc.nim
+++ b/tests/arc/tarcmisc.nim
@@ -173,3 +173,39 @@ proc bug14495 =
     echo o[]
 
 bug14495()
+
+when false:
+  # bug #14396
+  type
+    Spinny = ref object
+      t: ref int
+      text: string
+
+  proc newSpinny*(): Spinny =
+    Spinny(t: new(int), text: "hello")
+
+  proc spinnyLoop(x: ref int, spinny: sink Spinny) =
+    echo x[]
+
+  proc start*(spinny: sink Spinny) =
+    spinnyLoop(spinny.t, spinny)
+
+  var spinner1 = newSpinny()
+  spinner1.start()
+
+  # bug #14345
+
+  type
+    SimpleLoopB = ref object
+      children: seq[SimpleLoopB]
+      parent: SimpleLoopB
+
+  proc addChildLoop(self: SimpleLoopB, loop: SimpleLoopB) =
+    self.children.add loop
+
+  proc setParent(self: SimpleLoopB, parent: SimpleLoopB) =
+    self.parent = parent
+    self.parent.addChildLoop(self)
+
+  var l = SimpleLoopB()
+  l.setParent(l)