summary refs log blame commit diff stats
path: root/tests/vm/tnewseqofcap.nim
blob: c61c3c485f1ef3e36f4252ce53308b5a0bd13da5 (plain) (tree)


















                                                   
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