Co-authored-by: cooldome <ariabushenko@bk.ru>
This commit is contained in:
cooldome 2020-03-31 20:15:06 +01:00 • committed by GitHub
commit c70b3952ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View file

@ -2,7 +2,9 @@ discard """
output: '''
destroyed: false
destroyed: false
destroying variable'''
closed
destroying variable
'''
cmd: "nim c --gc:arc $file"
"""
@ -27,3 +29,22 @@ proc test(count: int) =
echo "destroyed: ", v.isNil
test(3)
#------------------------------------------------------------------------------
# issue #13810
import streams
type
A = ref AObj
AObj = object of RootObj
io: Stream
B = ref object of A
x: int
proc `=destroy`(x: var AObj) =
close(x.io)
echo "closed"
var x = B(io: newStringStream("thestream"))