summary refs log tree commit diff stats
path: root/tests/accept/compile/tdiscardable.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-09-24 19:18:08 +0200
committerAraq <rumpf_a@web.de>2011-09-24 19:18:08 +0200
commit485c371942cbbb1f9a10c64b6fcc699e59511460 (patch)
tree06afc132570838dd1b64c70b79d64f8fff3509b6 /tests/accept/compile/tdiscardable.nim
parent72ceda98cbbef896c31102a2c90d5f9fe1033d03 (diff)
downloadNim-485c371942cbbb1f9a10c64b6fcc699e59511460.tar.gz
renamed optional to discardable
Diffstat (limited to 'tests/accept/compile/tdiscardable.nim')
-rw-r--r--tests/accept/compile/tdiscardable.nim13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/accept/compile/tdiscardable.nim b/tests/accept/compile/tdiscardable.nim
new file mode 100644
index 000000000..c0551ba2f
--- /dev/null
+++ b/tests/accept/compile/tdiscardable.nim
@@ -0,0 +1,13 @@
+# Test the discardable pragma
+
+proc p(x, y: int): int {.discardable.} = 
+  return x + y
+
+# test that it is inherited from generic procs too:
+proc q[T](x, y: T): T {.discardable.} = 
+  return x + y
+
+
+p(8, 2)
+q[float](0.8, 0.2)
+