summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorjcosborn <jcosborn@users.noreply.github.com>2018-01-10 19:01:51 -0600
committerAndreas Rumpf <rumpf_a@web.de>2018-01-11 02:01:51 +0100
commitd0a9fac36252a135dba6304b9f7ccc18c899c267 (patch)
treeb8d7adc9c68d44c83f457c28c41929311a63aae5 /tests
parent2aebb8ed7ee3f442e478ec96e5af4c23957f6bb9 (diff)
downloadNim-d0a9fac36252a135dba6304b9f7ccc18c899c267.tar.gz
avoid creating temporary in genObjConstr if possible (#7032)
Diffstat (limited to 'tests')
-rw-r--r--tests/objects/tobjconstr.nim7
-rw-r--r--tests/objects/tobjconstr2.nim7
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/objects/tobjconstr.nim b/tests/objects/tobjconstr.nim
index b7da176aa..d1f3c8bdb 100644
--- a/tests/objects/tobjconstr.nim
+++ b/tests/objects/tobjconstr.nim
@@ -15,7 +15,8 @@ discard """
 (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
@@ -75,3 +76,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()
diff --git a/tests/objects/tobjconstr2.nim b/tests/objects/tobjconstr2.nim
index f6805190b..6253edab0 100644
--- a/tests/objects/tobjconstr2.nim
+++ b/tests/objects/tobjconstr2.nim
@@ -1,3 +1,8 @@
+discard """
+  output: '''42
+Foo'''
+"""
+
 type TFoo{.exportc.} = object
  x:int
 
@@ -48,3 +53,5 @@ type NamedGraphic = object of Graphic2
 
 var ngr = NamedGraphic(kind: Koo, radius: 6.9, name: "Foo")
 echo ngr.name
+
+GC_fullCollect()