diff options
author | Andrii Riabushenko <cdome@bk.ru> | 2019-09-02 10:11:51 +0100 |
---|---|---|
committer | Andrii Riabushenko <cdome@bk.ru> | 2019-09-02 10:11:51 +0100 |
commit | ba18c12005ddbf4859fac3a04ebb149ee20532b0 (patch) | |
tree | a1fcd9c453530ec250bebdda6dffcfda42e3e80f /tests | |
parent | ad82e65387f39970b0f12cbcb12d8b382236f3da (diff) | |
download | Nim-ba18c12005ddbf4859fac3a04ebb149ee20532b0.tar.gz |
sink as lvalue
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() |