summary refs log tree commit diff stats
path: root/tests/reject/tuninit1.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-06-09 23:29:43 +0200
committerAraq <rumpf_a@web.de>2013-06-09 23:29:43 +0200
commit23ef565a3c2c1f83816fefbeadb0fc59e754997d (patch)
tree7a2adeeb6f3215c35ff0b7fdeeee6f9907308931 /tests/reject/tuninit1.nim
parent2aaa8f7909e51eb3d971e197f152e247c64362e9 (diff)
downloadNim-23ef565a3c2c1f83816fefbeadb0fc59e754997d.tar.gz
implemented large parts of the 'not nil' checking
Diffstat (limited to 'tests/reject/tuninit1.nim')
-rw-r--r--tests/reject/tuninit1.nim36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/reject/tuninit1.nim b/tests/reject/tuninit1.nim
new file mode 100644
index 000000000..e51f9ce7c
--- /dev/null
+++ b/tests/reject/tuninit1.nim
@@ -0,0 +1,36 @@
+discard """
+  errormsg: "'y' might not have been initialized"
+  line:28
+"""
+
+import strutils
+
+{.warning[Uninit]:on.}
+
+proc p =
+  var x, y, z: int
+  if stdin.readLine == "true":
+    x = 34
+    
+    while false:
+      y = 999
+      break
+      
+    while true:
+      if x == 12: break
+      y = 9999
+      
+    try:
+      z = parseInt("1233")
+    except E_Base:
+      case x
+      of 34: z = 123
+      of 13: z = 34
+      else: z = 8
+  else:
+    y = 3444
+    x = 3111
+    z = 0
+  echo x, y, z
+  
+p()