summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-11-20 14:34:05 +0100
committerGitHub <noreply@github.com>2019-11-20 14:34:05 +0100
commit85ffcd80c05ae1bbf853121059c39a215a29ae54 (patch)
tree04d342d28caedab16c27aca10e3a3647c87944c3 /tests
parenta88004114d6bfbef31268c96f4d1fc871e70ab03 (diff)
downloadNim-85ffcd80c05ae1bbf853121059c39a215a29ae54.tar.gz
more arc improvements (#12690)
* ARC: bugfix for =destroy for inherited objects
* added code useful for debugging
Diffstat (limited to 'tests')
-rw-r--r--tests/destructor/tarc.nim (renamed from tests/destructor/tlists.nim)17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/destructor/tlists.nim b/tests/destructor/tarc.nim
index f5786d936..5c78605d2 100644
--- a/tests/destructor/tlists.nim
+++ b/tests/destructor/tarc.nim
@@ -4,7 +4,7 @@ discard """
 Success
 @["a", "b", "c"]
 0'''
-  cmd: '''nim c --gc:destructors $file'''
+  cmd: '''nim c --gc:arc $file'''
 """
 
 import os
@@ -69,10 +69,23 @@ proc take3 =
   for x in infinite.take(3):
     discard
 
+
+type
+  A = ref object of RootObj
+    x: int
+
+  B = ref object of A
+    more: string
+
+proc inheritanceBug(param: string) =
+  var s: (A, A)
+  s[0] = B(more: "a" & param)
+  s[1] = B(more: "a" & param)
+
 let startMem = getOccupiedMem()
 take3()
 tlazyList()
-
+inheritanceBug("whatever")
 mkManyLeaks()
 tsimpleClosureIterator()
 tleakingNewStmt()