summary refs log tree commit diff stats
path: root/tests/modules
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-07-26 08:20:02 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-07-26 08:20:11 +0200
commit50f62ff44a4c448eceacd2d0f8b8fe8457a2e820 (patch)
tree1b251159a9c04f819c137455cfced1a22c71ce5b /tests/modules
parente00953cbc08b0eed3fec6044216e5764c85da076 (diff)
downloadNim-50f62ff44a4c448eceacd2d0f8b8fe8457a2e820.tar.gz
distinguish between 'reorder' and 'noforward'
Diffstat (limited to 'tests/modules')
-rw-r--r--tests/modules/treorder.nim42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/modules/treorder.nim b/tests/modules/treorder.nim
new file mode 100644
index 000000000..abe74c5df
--- /dev/null
+++ b/tests/modules/treorder.nim
@@ -0,0 +1,42 @@
+discard """
+  cmd: "nim -d:testdef $target $file"
+  output: '''works 34
+34
+defined
+first impl'''
+"""
+
+{.reorder: on.}
+
+{.push callconv: stdcall.}
+proc bar(x: T)
+
+proc foo() =
+  bar(34)
+  whendep()
+
+proc foo(dummy: int) = echo dummy
+
+proc bar(x: T) =
+  echo "works ", x
+  foo(x)
+
+foo()
+
+type
+  T = int
+
+when defined(testdef):
+  proc whendep() = echo "defined"
+else:
+  proc whendep() = echo "undefined"
+
+when not declared(goo):
+  proc goo() = echo "first impl"
+
+when not declared(goo):
+  proc goo() = echo "second impl"
+
+goo()
+
+{.pop.}