* ensure capitalize doesn't take an inferred sink parameter * sink parameter inference: first version, for now disabled. Changed that sink parameters can be consumed multiple times in order to adhere to our spec. * sink inference can now be disabled with .nosinks; sometimes for proc type interop this is required * fixes yet another critical DFA bug * better implementation that also understands if expressions etc * document sink parameter inference and allow for global disabling
30 lines
483 B
Nim
30 lines
483 B
Nim
discard """
|
|
output: '''leak: false'''
|
|
cmd: '''nim c --gc:orc $file'''
|
|
"""
|
|
|
|
type
|
|
T = ref object
|
|
s: seq[T]
|
|
data: string
|
|
|
|
proc create(): T = T(s: @[], data: "abc")
|
|
|
|
proc addX(x: T; data: string) =
|
|
x.data = data
|
|
|
|
{.push sinkInference: off.}
|
|
|
|
proc addX(x: T; child: T) =
|
|
x.s.add child
|
|
|
|
{.pop.}
|
|
|
|
proc main(rootName: string) =
|
|
var root = create()
|
|
root.data = rootName
|
|
root.addX root
|
|
|
|
let mem = getOccupiedMem()
|
|
main("yeah")
|
|
echo "leak: ", getOccupiedMem() - mem > 0
|