mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-31 02:43:41 +00:00
implemented large parts of the 'not nil' checking
This commit is contained in:
36
tests/reject/tuninit1.nim
Normal file
36
tests/reject/tuninit1.nim
Normal file
@@ -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()
|
||||
Reference in New Issue
Block a user