diff options
Diffstat (limited to 'tests/vm/tnewseqofcap.nim')
-rw-r--r-- | tests/vm/tnewseqofcap.nim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/vm/tnewseqofcap.nim b/tests/vm/tnewseqofcap.nim new file mode 100644 index 000000000..a7dc07aa6 --- /dev/null +++ b/tests/vm/tnewseqofcap.nim @@ -0,0 +1,14 @@ +const + foo = @["aaa", "bbb", "ccc"] + +proc myTuple: tuple[n: int, bar: seq[string]] = + result.n = 42 + result.bar = newSeqOfCap[string](foo.len) + for f in foo: + result.bar.add(f) + +# It works if you change the below `const` to `let` +const + (n, bar) = myTuple() + +doAssert bar == @["aaa", "bbb", "ccc"] \ No newline at end of file |