summary refs log tree commit diff stats
path: root/lib/system/deepcopy.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-11-28 11:03:01 +0100
committerAndreas Rumpf <rumpf_a@web.de>2016-11-28 11:03:01 +0100
commit734443d725724df0d328d27982fbc2c54d1ff683 (patch)
tree5fcda236b6faacba1c1cc26b97020b539d792a56 /lib/system/deepcopy.nim
parent7ca72a733c7960eee1c86a4c46b0aac47fe851fc (diff)
downloadNim-734443d725724df0d328d27982fbc2c54d1ff683.tar.gz
system.deepCopy should show old behaviour
Diffstat (limited to 'lib/system/deepcopy.nim')
-rw-r--r--lib/system/deepcopy.nim7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/system/deepcopy.nim b/lib/system/deepcopy.nim
index b1609252c..c137b3cf6 100644
--- a/lib/system/deepcopy.nim
+++ b/lib/system/deepcopy.nim
@@ -134,7 +134,7 @@ proc genericDeepCopyAux(dest, src: pointer, mt: PNimType; tab: var PtrTable) =
     else:
       let z = tab.get(s2)
       if z == nil:
-        when declared(usrToCell) and false:
+        when declared(usrToCell):
           let x = usrToCell(s2)
           let realType = x.typ
           let z = newObj(realType, realType.base.size)
@@ -142,6 +142,11 @@ proc genericDeepCopyAux(dest, src: pointer, mt: PNimType; tab: var PtrTable) =
           tab.put(s2, z)
           genericDeepCopyAux(z, s2, realType.base, tab)
         else:
+          when false:
+            # addition check disabled
+            let x = usrToCell(s2)
+            let realType = x.typ
+            sysAssert realType == mt, " types do differ"
           # this version should work for any possible GC:
           let size = if mt.base.kind == tyObject: cast[ptr PNimType](s2)[].size else: mt.base.size
           let z = newObj(mt, size)