mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-05 04:27:44 +00:00
* 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
31 lines
699 B
Nim
31 lines
699 B
Nim
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)
|