summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2013-12-25 22:40:06 +0200
committerZahary Karadjov <zahary@gmail.com>2013-12-25 22:40:06 +0200
commit86108be24b43d1b4b02a6549e75f64b7625233ac (patch)
tree419e23e4a039dfc603cb224c858d583fa38ae8a4
parentedab4aaad02bf414f7f0c6e3148ade8a7b485c40 (diff)
downloadNim-86108be24b43d1b4b02a6549e75f64b7625233ac.tar.gz
test case for semistatic
-rw-r--r--tests/run/tsemistatic.nim24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/run/tsemistatic.nim b/tests/run/tsemistatic.nim
new file mode 100644
index 000000000..d187f153c
--- /dev/null
+++ b/tests/run/tsemistatic.nim
@@ -0,0 +1,24 @@
+discard """
+  msg: "static 10\ndynamic\nstatic 20\n"
+  output: "s\nd\nd\ns"
+"""
+
+proc foo(x: semistatic[int]) =
+  when isStatic(x):
+    static: echo "static ", x
+    echo "s"
+  else:
+    static: echo "dynamic"
+    echo "d"
+
+foo 10
+
+var
+  x = 10
+  y: int
+
+foo x
+foo y
+
+foo 20
+