diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2020-11-02 17:27:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-02 10:27:48 +0100 |
commit | 558115fa2906abeda11e6fd128ac139e9aac1838 (patch) | |
tree | 87ed3a89ca7e3fdf330f9b84bd2cac149b97f4be /tests/vm | |
parent | 919593395c7325ffd1cb93fb787c2772da2195f0 (diff) | |
download | Nim-558115fa2906abeda11e6fd128ac139e9aac1838.tar.gz |
fixes #15717
Diffstat (limited to 'tests/vm')
-rw-r--r-- | tests/vm/tnewseqofcap.nim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/vm/tnewseqofcap.nim b/tests/vm/tnewseqofcap.nim new file mode 100644 index 000000000..c61c3c485 --- /dev/null +++ b/tests/vm/tnewseqofcap.nim @@ -0,0 +1,19 @@ +discard """ + output: '''@["aaa", "bbb", "ccc"]''' +""" + + +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() + +echo bar \ No newline at end of file |