mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-05 20:47:53 +00:00
check there is only one deepCopy per type
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user