This reverts commit ab740cb5b9.
This commit is contained in:
parent
cee58ccf7f
commit
9edf719e1e
7 changed files with 127 additions and 138 deletions
|
|
@ -93,6 +93,7 @@ destroy
|
|||
destroy
|
||||
destroy
|
||||
sink
|
||||
sink
|
||||
destroy
|
||||
copy
|
||||
(f: 1)
|
||||
|
|
@ -686,7 +687,7 @@ caseNotAConstant()
|
|||
|
||||
proc potentialSelfAssign(i: var int) =
|
||||
var a: array[2, OO]
|
||||
a[i] = OO(f: 1) # turned into a memcopy
|
||||
a[i] = OO(f: 1)
|
||||
a[1] = OO(f: 2)
|
||||
a[i+1] = a[i] # This must not =sink, but =copy
|
||||
inc i
|
||||
|
|
@ -743,30 +744,3 @@ proc partToWholeUnownedRef =
|
|||
|
||||
partToWholeUnownedRef()
|
||||
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# test that nodes that get copied during the transformation
|
||||
# (like dot exprs) don't loose their firstWrite/lastRead property
|
||||
|
||||
type
|
||||
OOO = object
|
||||
initialized: bool
|
||||
|
||||
C = object
|
||||
o: OOO
|
||||
|
||||
proc `=destroy`(o: var OOO) =
|
||||
doAssert o.initialized, "OOO was destroyed before initialization!"
|
||||
|
||||
proc initO(): OOO =
|
||||
OOO(initialized: true)
|
||||
|
||||
proc initC(): C =
|
||||
C(o: initO())
|
||||
|
||||
proc pair(): tuple[a: C, b: C] =
|
||||
result.a = initC() # <- when firstWrite tries to find this node to start its analysis it fails, because injectdestructors uses copyTree/shallowCopy
|
||||
result.b = initC()
|
||||
|
||||
discard pair()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue