diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-09-02 15:49:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-02 15:49:01 +0200 |
commit | f8f96d816cdd1a8edc3f1582a76ae483035f6a37 (patch) | |
tree | 396ab5cf59d41fd8bf58a63a39e58b5f21c8a334 /tests | |
parent | 7ef85db9a9e3df4d6630673ceac33e9fb986e2ed (diff) | |
parent | ba18c12005ddbf4859fac3a04ebb149ee20532b0 (diff) | |
download | Nim-f8f96d816cdd1a8edc3f1582a76ae483035f6a37.tar.gz |
sink as lvalue (#12108)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/destructor/tnewruntime_misc.nim | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/destructor/tnewruntime_misc.nim b/tests/destructor/tnewruntime_misc.nim index d6c03b9b0..8abf0d30b 100644 --- a/tests/destructor/tnewruntime_misc.nim +++ b/tests/destructor/tnewruntime_misc.nim @@ -85,3 +85,16 @@ testWrongAt() let (a, d) = allocCounters() discard cprintf("%ld new: %ld\n", a - unpairedEnvAllocs() - d, allocs) + +#------------------------------------------------- +type + Table[A, B] = object + x: seq[(A, B)] + + +proc toTable[A,B](p: sink openArray[(A, B)]): Table[A, B] = + for zz in mitems(p): + result.x.add move(zz) + + +let table = {"a": new(int)}.toTable() |