check there is only one deepCopy per type
This commit is contained in:
parent
053b34d91d
commit
3df553ef25
1 changed files with 4 additions and 1 deletions
|
|
@ -1020,7 +1020,10 @@ proc semOverride(c: PContext, s: PSym, n: PNode) =
|
|||
# the problem that pointers are structural types:
|
||||
let t = s.typ.sons[1].skipTypes(abstractInst).lastSon.skipTypes(abstractInst)
|
||||
if t.kind in {tyObject, tyDistinct, tyEnum}:
|
||||
t.deepCopy = s
|
||||
if t.deepCopy.isNil: t.deepCopy = s
|
||||
else:
|
||||
localError(n.info, errGenerated,
|
||||
"cannot bind another 'deepCopy' to: " & typeToString(t))
|
||||
else:
|
||||
localError(n.info, errGenerated,
|
||||
"cannot bind 'deepCopy' to: " & typeToString(t))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue