summary refs log tree commit diff stats
path: root/tests/accept
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-09-24 13:55:24 +0200
committerAraq <rumpf_a@web.de>2011-09-24 13:55:24 +0200
commit72ceda98cbbef896c31102a2c90d5f9fe1033d03 (patch)
treee8d5ba9d5602c6a1455c17da85dbf05b86ca02d7 /tests/accept
parent033e3dfc50349ffeb5f9d9e839bd62fa22113b69 (diff)
downloadNim-72ceda98cbbef896c31102a2c90d5f9fe1033d03.tar.gz
implemented optional pragma for implicit discard
Diffstat (limited to 'tests/accept')
-rw-r--r--tests/accept/compile/toptional_pragma.nim13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/accept/compile/toptional_pragma.nim b/tests/accept/compile/toptional_pragma.nim
new file mode 100644
index 000000000..80ebe68a3
--- /dev/null
+++ b/tests/accept/compile/toptional_pragma.nim
@@ -0,0 +1,13 @@
+# Test the optional pragma
+
+proc p(x, y: int): int {.optional.} = 
+  return x + y
+
+# test that it is inherited from generic procs too:
+proc q[T](x, y: T): T {.optional.} = 
+  return x + y
+
+
+p(8, 2)
+q[float](0.8, 0.2)
+