summary refs log tree commit diff stats
path: root/tests/arc
diff options
context:
space:
mode:
authorClyybber <darkmine956@gmail.com>2020-05-07 21:41:55 +0200
committerGitHub <noreply@github.com>2020-05-07 21:41:55 +0200
commit42db75c9707d6501cb1ef1908e7092286b25ac45 (patch)
treed8c40623adf14845682453cd72e3c5c0661ca66b /tests/arc
parent1a1e9986a34822d16cd20ec5b2a908a10677f4fd (diff)
downloadNim-42db75c9707d6501cb1ef1908e7092286b25ac45.tar.gz
Fix the DFA for "unstructured controlflow" (#14263)
* Fix the DFA for "unstructured controlflow"

* Add testcase from #14233
Diffstat (limited to 'tests/arc')
-rw-r--r--tests/arc/tcontrolflow.nim24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/arc/tcontrolflow.nim b/tests/arc/tcontrolflow.nim
index 8fc9bf61d..efe51cc32 100644
--- a/tests/arc/tcontrolflow.nim
+++ b/tests/arc/tcontrolflow.nim
@@ -10,6 +10,7 @@ end false
 begin true
 if
 end true
+7
 '''
   cmd: "nim c --gc:arc -d:danger $file"
   disabled: "true"
@@ -53,3 +54,26 @@ proc orIsHard(cond: bool) =
 
 orIsHard(false)
 orIsHard(true)
+
+type
+  Control = ref object
+    x: int
+
+  MouseEvent = ref object
+    control: Control
+    button: int
+
+proc run(data: Control) =
+  var evt = MouseEvent(button: 1)
+  evt.control = data
+  if evt.button == 1:
+    discard
+  else: 
+    return
+  
+  echo data.x
+
+var c = Control(x: 7)
+
+run(c)
+