diff options
author | Clyybber <darkmine956@gmail.com> | 2021-03-26 13:05:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-26 13:05:51 +0100 |
commit | bb3769975b7cbbe2f84c288d7f3363b6bad9ca0e (patch) | |
tree | 79df78206afc32f5bbf0286ba955acc36647d344 /tests/arc/tarcmisc.nim | |
parent | e3e97421438da27267b159b922d7338fa92f1cd8 (diff) | |
download | Nim-bb3769975b7cbbe2f84c288d7f3363b6bad9ca0e.tar.gz |
Fix #17199 (#17348)
* don't zero out in a move in the VM * Add testcases for #17199 * Update tests/arc/tarcmisc.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update tests/vm/tissues.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Fix test failures * Fix test * Fix tests Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Diffstat (limited to 'tests/arc/tarcmisc.nim')
-rw-r--r-- | tests/arc/tarcmisc.nim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/arc/tarcmisc.nim b/tests/arc/tarcmisc.nim index 55803085f..82751f44c 100644 --- a/tests/arc/tarcmisc.nim +++ b/tests/arc/tarcmisc.nim @@ -390,3 +390,35 @@ proc newPixelBuffer(): PixelBuffer = discard newPixelBuffer() + +# bug #17199 + +proc passSeq(data: seq[string]) = + # used the system.& proc initially + let wat = data & "hello" + +proc test2 = + let name = @["hello", "world"] + passSeq(name) + doAssert name == @["hello", "world"] + +static: test2() # was buggy +test2() + +proc merge(x: sink seq[string], y: sink string): seq[string] = + newSeq(result, x.len + 1) + for i in 0..x.len-1: + result[i] = move(x[i]) + result[x.len] = move(y) + +proc passSeq2(data: seq[string]) = + # used the system.& proc initially + let wat = merge(data, "hello") + +proc test3 = + let name = @["hello", "world"] + passSeq2(name) + doAssert name == @["hello", "world"] + +static: test3() # was buggy +test3() |