diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-04-21 21:22:36 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-04-21 21:22:36 +0200 |
commit | 85ea9593b38351e69fedac61ff0c2b958bac4b7f (patch) | |
tree | b991e735138440769ae7e995172b3ab4be438d4d /lib/system | |
parent | 14046d975dd0c5a5195dea7d6bdcb3daa8e69eca (diff) | |
download | Nim-85ea9593b38351e69fedac61ff0c2b958bac4b7f.tar.gz |
fixes #7637; assignments are not allowed to slice object; minor breaking change
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/assign.nim | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/system/assign.nim b/lib/system/assign.nim index f061c89cf..ff1ef31d2 100644 --- a/lib/system/assign.nim +++ b/lib/system/assign.nim @@ -79,8 +79,12 @@ proc genericAssignAux(dest, src: pointer, mt: PNimType, shallow: bool) = GenericSeqSize), mt.base, shallow) of tyObject: - if mt.base != nil: - genericAssignAux(dest, src, mt.base, shallow) + var it = mt.base + # don't use recursion here on the PNimType because the subtype + # check should only be done at the very end: + while it != nil: + genericAssignAux(dest, src, it.node, shallow) + it = it.base genericAssignAux(dest, src, mt.node, shallow) # we need to copy m_type field for tyObject, as it could be empty for # sequence reallocations: @@ -89,6 +93,8 @@ proc genericAssignAux(dest, src: pointer, mt: PNimType, shallow: bool) = # if p of TB: # var tbObj = TB(p) # tbObj of TC # needs to be false! + #c_fprintf(stdout, "%s %s\n", pint[].name, mt.name) + chckObjAsgn(cast[ptr PNimType](src)[], mt) pint[] = mt # cast[ptr PNimType](src)[] of tyTuple: genericAssignAux(dest, src, mt.node, shallow) |