summary refs log tree commit diff stats
path: root/tests/objects/tobjconstr.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/objects/tobjconstr.nim')
-rw-r--r--tests/objects/tobjconstr.nim14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/objects/tobjconstr.nim b/tests/objects/tobjconstr.nim
index b7da176aa..7238d10c7 100644
--- a/tests/objects/tobjconstr.nim
+++ b/tests/objects/tobjconstr.nim
@@ -9,13 +9,14 @@ discard """
 (k: kindA, a: (x: "abc", z: [1, 8, 3]), method: ())
 (k: kindA, a: (x: "abc", z: [1, 9, 3]), method: ())
 (k: kindA, a: (x: "abc", z: [1, 10, 3]), method: ())
-(x: 123)
-(x: 123)
+(y: 0, x: 123)
+(y: 678, x: 123)
 (z: 89, y: 0, x: 128)
 (y: 678, x: 123)
 (y: 678, x: 123)
 (y: 0, x: 123)
-(y: 678, x: 123)'''
+(y: 678, x: 123)
+(y: 123, x: 678)'''
 """
 
 type
@@ -32,7 +33,6 @@ type
       `method`: TEmpty # bug #1791
 
 proc `$`[T](s: seq[T]): string =
-  # XXX why is that not in the stdlib?
   result = "["
   for i, x in s:
     if i > 0: result.add(", ")
@@ -58,7 +58,7 @@ type
 # inherited fields are ignored, so no fields are set
 when true:
   var
-    o: A
+    o: B
   o = B(x: 123)
   echo o
   o = B(y: 678, x: 123)
@@ -75,3 +75,7 @@ when true:
   echo b                  # (y: 0, x: 123)
   b=B(y: 678, x: 123)
   echo b                  # (y: 678, x: 123)
+  b=B(y: b.x, x: b.y)
+  echo b                  # (y: 123, x: 678)
+
+GC_fullCollect()