diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-03-18 16:57:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-18 16:57:34 +0100 |
commit | fb641483f0e2ed974b89d629ea5ec28e5e6145ce (patch) | |
tree | 8f74544adb04d46a7946554e2fd73e6bbc417ff3 /tests/destructor | |
parent | a96842aaeb46ddf3990f9632259a26cb451c5b80 (diff) | |
download | Nim-fb641483f0e2ed974b89d629ea5ec28e5e6145ce.tar.gz |
arc optimizations (#13325)
* scope based destructors * handle 'or' and 'and' expressions properly, see the new test arc/tcontrolflow.nim * make this branch mergable, logic is disabled for now
Diffstat (limited to 'tests/destructor')
-rw-r--r-- | tests/destructor/tasync_prototype.nim | 5 | ||||
-rw-r--r-- | tests/destructor/tdestructor.nim | 2 | ||||
-rw-r--r-- | tests/destructor/tmisc_destructors.nim | 2 | ||||
-rw-r--r-- | tests/destructor/tv2_raise.nim | 2 |
4 files changed, 8 insertions, 3 deletions
diff --git a/tests/destructor/tasync_prototype.nim b/tests/destructor/tasync_prototype.nim index bd80adf0c..81fd824e9 100644 --- a/tests/destructor/tasync_prototype.nim +++ b/tests/destructor/tasync_prototype.nim @@ -32,7 +32,12 @@ proc serve(server: PAsyncHttpServer): PFutureBase = yield acceptAddrFut var fut = acceptAddrFut.value + # with the new scope based destruction, this cannot + # possibly work: var f {.cursor.} = processClient() + # It also seems to be the wrong way how to avoid the + # cycle. The cycle is caused by capturing the 'env' + # part from 'env.f'. when true: f.callback = proc () = diff --git a/tests/destructor/tdestructor.nim b/tests/destructor/tdestructor.nim index 5cfecea4e..b6d60323c 100644 --- a/tests/destructor/tdestructor.nim +++ b/tests/destructor/tdestructor.nim @@ -33,7 +33,7 @@ type p: pointer proc `=destroy`(o: var TMyObj) = - if o.p != nil: + if o.p != nil: dealloc o.p o.p = nil echo "myobj destroyed" diff --git a/tests/destructor/tmisc_destructors.nim b/tests/destructor/tmisc_destructors.nim index 53c67e34b..73c54eab3 100644 --- a/tests/destructor/tmisc_destructors.nim +++ b/tests/destructor/tmisc_destructors.nim @@ -22,7 +22,7 @@ proc `=`(dest: var Foo, src: Foo) = assign_counter.inc proc test(): auto = - var a,b : Foo + var a, b: Foo return (a, b, Foo(boo: 5)) var (a, b, _) = test() diff --git a/tests/destructor/tv2_raise.nim b/tests/destructor/tv2_raise.nim index 828d0a396..4ea94a864 100644 --- a/tests/destructor/tv2_raise.nim +++ b/tests/destructor/tv2_raise.nim @@ -2,7 +2,7 @@ discard """ valgrind: true cmd: '''nim c -d:nimAllocStats --newruntime $file''' output: '''OK 3 -(allocCount: 8, deallocCount: 3)''' +(allocCount: 8, deallocCount: 5)''' """ import strutils, math |