summary refs log blame commit diff stats
path: root/tests/vm/tnewseqofcap.nim
blob: a7dc07aa676dce7faf6f84360d5e5f66334502e3 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                   
                                     
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"]