summary refs log tree commit diff stats
path: root/tests/arc/tcontrolflow.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/arc/tcontrolflow.nim')
-rw-r--r--tests/arc/tcontrolflow.nim34
1 files changed, 31 insertions, 3 deletions
diff --git a/tests/arc/tcontrolflow.nim b/tests/arc/tcontrolflow.nim
index 478806567..dbc115903 100644
--- a/tests/arc/tcontrolflow.nim
+++ b/tests/arc/tcontrolflow.nim
@@ -1,17 +1,18 @@
 discard """
   output: '''begin A
 elif
-destroyed
 end A
+destroyed
 begin false
 if
-destroyed
 end false
+destroyed
 begin true
 if
 end true
 7
 ##index 2 not in 0 .. 1##
+true
 '''
   cmd: "nim c --gc:arc -d:danger $file"
 """
@@ -75,7 +76,7 @@ var c = Control(x: 7)
 
 run(c)
 
-proc sysFatal(exceptn: typedesc, message: string) {.inline, noreturn.} =
+proc sysFatal(exceptn: typedesc, message: string) {.inline.} =
   var buf = newStringOfCap(200)
   add(buf, "##")
   add(buf, message)
@@ -88,3 +89,30 @@ proc ifexpr(i, a, b: int) {.compilerproc, noinline.} =
     else: "index " & $i & " not in " & $a & " .. " & $b)
 
 ifexpr(2, 0, 1)
+
+# bug #14899
+template toSeq(): untyped =
+  block:
+    var result = @[1]
+    result
+
+proc clItems(s: seq[int]) =
+  assert s.len == 1
+
+proc escapeCheck =
+  clItems(toSeq())
+
+escapeCheck()
+
+# bug #14900
+
+proc seqsEqual(a, b: string): bool =
+  if false:
+    false
+  else:
+    (var result1 = a; result1) == (var result2 = b; result2)
+
+# can be const or var too
+let expected = "hello"
+
+echo seqsEqual(expected, expected)