revert discard in destroyer (#10840)
* revert discard in destroyer * disable test
This commit is contained in:
parent
e263702688
commit
5dea7c5ad7
3 changed files with 1 additions and 27 deletions
|
|
@ -697,10 +697,6 @@ proc p(n: PNode; c: var Con): PNode =
|
||||||
of nkNone..nkNilLit, nkTypeSection, nkProcDef, nkConverterDef, nkMethodDef,
|
of nkNone..nkNilLit, nkTypeSection, nkProcDef, nkConverterDef, nkMethodDef,
|
||||||
nkIteratorDef, nkMacroDef, nkTemplateDef, nkLambda, nkDo, nkFuncDef:
|
nkIteratorDef, nkMacroDef, nkTemplateDef, nkLambda, nkDo, nkFuncDef:
|
||||||
result = n
|
result = n
|
||||||
of nkDiscardStmt:
|
|
||||||
result = n
|
|
||||||
if n[0].typ != nil and hasDestructor(n[0].typ):
|
|
||||||
result = genDestroy(c, n[0].typ, n[0])
|
|
||||||
of nkCast, nkHiddenStdConv, nkHiddenSubConv, nkConv:
|
of nkCast, nkHiddenStdConv, nkHiddenSubConv, nkConv:
|
||||||
result = copyNode(n)
|
result = copyNode(n)
|
||||||
# Destination type
|
# Destination type
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
discard """
|
|
||||||
joinable: false
|
|
||||||
target: "C"
|
|
||||||
"""
|
|
||||||
|
|
||||||
type
|
|
||||||
O = object
|
|
||||||
|
|
||||||
var dCalls = 0
|
|
||||||
|
|
||||||
proc `=destroy`(x: var O) = inc dCalls
|
|
||||||
proc `=sink`(x: var O, y: O) = doAssert false
|
|
||||||
|
|
||||||
proc newO(): O = discard
|
|
||||||
|
|
||||||
proc main() =
|
|
||||||
doAssert dCalls == 0
|
|
||||||
discard newO()
|
|
||||||
doAssert dCalls == 1
|
|
||||||
discard newO()
|
|
||||||
doAssert dCalls == 2
|
|
||||||
|
|
||||||
main()
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
|
disabled: true
|
||||||
cmd: '''nim c --gc:destructors $file'''
|
cmd: '''nim c --gc:destructors $file'''
|
||||||
output: '''hi
|
output: '''hi
|
||||||
ho
|
ho
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue