diff options
author | metagn <metagngn@gmail.com> | 2023-03-28 18:52:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-28 17:52:23 +0200 |
commit | 2315b01ae691e5e9e54fdfdfb4642c8fbc559e48 (patch) | |
tree | 60d0db9a08ff22b375fe44ff8b841264fddefa1f /tests/arc | |
parent | 4fc9f0c3a3c6f53bfb663e60775e3d7a75c56337 (diff) | |
download | Nim-2315b01ae691e5e9e54fdfdfb4642c8fbc559e48.tar.gz |
tuple unpacking for vars as just sugar, allowing nesting (#21563)
* tuple unpacking for vars as just sugar, allowing nesting * set temp symbol AST * hopeful fix some issues, add test for #19364 * always use temp for consts * document, fix small issue * fix manual indentation * actually fix manual * use helper proc * don't resem temp tuple assignment
Diffstat (limited to 'tests/arc')
-rw-r--r-- | tests/arc/t19364.nim | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/arc/t19364.nim b/tests/arc/t19364.nim new file mode 100644 index 000000000..f520f3291 --- /dev/null +++ b/tests/arc/t19364.nim @@ -0,0 +1,30 @@ +discard """ + cmd: '''nim c --gc:arc --expandArc:fooLeaks $file''' + nimout: ''' +--expandArc: fooLeaks + +var + tmpTuple_cursor + a_cursor + b_cursor + c_cursor +tmpTuple_cursor = refTuple +a_cursor = tmpTuple_cursor[0] +b_cursor = tmpTuple_cursor[1] +c_cursor = tmpTuple_cursor[2] +-- end of expandArc ------------------------ +''' +""" + +func fooLeaks(refTuple: tuple[a, + b, + c: seq[float]]): float = + let (a, b, c) = refTuple + +let refset = (a: newSeq[float](25_000_000), + b: newSeq[float](25_000_000), + c: newSeq[float](25_000_000)) + +var res = newSeq[float](1_000_000) +for i in 0 .. res.high: + res[i] = fooLeaks(refset) |