summary refs log tree commit diff stats
path: root/drnim/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-04-19 02:41:16 +0200
committerGitHub <noreply@github.com>2020-04-19 02:41:16 +0200
commita8f030fea21894e51c188a5804b0bbf787335f4d (patch)
treefbce3b5a958232b949fb6a462c50abe66b752c15 /drnim/tests
parentf1ee817627d10b246bc797420587f4d774b6ae29 (diff)
downloadNim-a8f030fea21894e51c188a5804b0bbf787335f4d.tar.gz
drnim: phi nodes for 'if' statements (#13990)
Diffstat (limited to 'drnim/tests')
-rw-r--r--drnim/tests/tphi.nim23
1 files changed, 23 insertions, 0 deletions
diff --git a/drnim/tests/tphi.nim b/drnim/tests/tphi.nim
new file mode 100644
index 000000000..7ff49f4dc
--- /dev/null
+++ b/drnim/tests/tphi.nim
@@ -0,0 +1,23 @@
+discard """
+  nimout: '''tphi.nim(9, 10) Warning: BEGIN [User]
+tphi.nim(22, 10) Warning: END [User]'''
+  cmd: "drnim $file"
+  action: "compile"
+"""
+import std/logic
+{.push staticBoundChecks: defined(nimDrNim).}
+{.warning: "BEGIN".}
+
+proc testAsgn(y: int) =
+  var a = y
+  if a > 0:
+    if a > 3:
+      a = a + 2
+    else:
+      a = a + 1
+    {.assert: a > 1.}
+
+testAsgn(3)
+
+{.warning: "END".}
+{.pop.}