diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/generics/tbadgenericlambda.nim | 7 | ||||
-rw-r--r-- | tests/generics/tgenericlambda.nim | 7 |
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/generics/tbadgenericlambda.nim b/tests/generics/tbadgenericlambda.nim new file mode 100644 index 000000000..5e406cacc --- /dev/null +++ b/tests/generics/tbadgenericlambda.nim @@ -0,0 +1,7 @@ +discard """ + msg: "nested proc can have generic parameters only when" + line: 6 +""" + +let x = proc (x, y): auto = x + y + diff --git a/tests/generics/tgenericlambda.nim b/tests/generics/tgenericlambda.nim index f7aafe1d9..eb6ada3e5 100644 --- a/tests/generics/tgenericlambda.nim +++ b/tests/generics/tgenericlambda.nim @@ -1,5 +1,5 @@ discard """ - output: "10\n10\n1\n2\n3" + output: "10\n10\n1\n2\n3\n15" """ proc test(x: proc (a, b: int): int) = @@ -16,3 +16,8 @@ proc foreach[T](s: seq[T], body: proc(x: T)) = foreach(@[1,2,3]) do (x): echo x +proc foo = + let x = proc (a, b: int): auto = a + b + echo x(5, 10) + +foo() |