summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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
+