check there is only one deepCopy per type

This commit is contained in:
Araq
2014-08-05 21:38:49 +02:00
parent 053b34d91d
commit 3df553ef25

View File

@@ -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))