From c70b3952ff6fc181875c3ca1a28c6bba6617c1a8 Mon Sep 17 00:00:00 2001 From: cooldome Date: Tue, 31 Mar 2020 20:15:06 +0100 Subject: fixes #13810 (#13821) Co-authored-by: cooldome --- tests/arc/tarcmisc.nim | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/arc/tarcmisc.nim b/tests/arc/tarcmisc.nim index 9662ecf7f..687254794 100644 --- a/tests/arc/tarcmisc.nim +++ b/tests/arc/tarcmisc.nim @@ -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")) -- cgit 1.4.1-2-gfad0