Files
Nim/tests/generics/tgenericlambda.nim
Zahary Karadjov cf8fe16a48 fix #715 again
the regression was caused by the introduction of "generic" lambdas
2014-03-16 20:42:06 +02:00

24 lines
352 B
Nim

discard """
output: "10\n10\n1\n2\n3\n15"
"""
proc test(x: proc (a, b: int): int) =
echo x(5, 5)
test(proc (a, b): auto = a + b)
test do (a, b) -> auto: a + b
proc foreach[T](s: seq[T], body: proc(x: T)) =
for e in s:
body(e)
foreach(@[1,2,3]) do (x):
echo x
proc foo =
let x = proc (a, b: int): auto = a + b
echo x(5, 10)
foo()