summary refs log tree commit diff stats
path: root/tests/reject/tnotnil2.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/reject/tnotnil2.nim')
-rw-r--r--tests/reject/tnotnil2.nim24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/reject/tnotnil2.nim b/tests/reject/tnotnil2.nim
new file mode 100644
index 000000000..bd6b8b675
--- /dev/null
+++ b/tests/reject/tnotnil2.nim
@@ -0,0 +1,24 @@
+discard """
+  errormsg: "cannot prove 'y' is not nil"
+  line:20
+"""
+
+import strutils
+
+
+type
+  TObj = object
+    x, y: int
+
+proc q(x: pointer not nil) =
+  nil
+
+proc p() =
+  var x: pointer
+  let y = x
+  if not y.isNil or y != x:
+    q(y)
+  else:
+    q(y)
+
+p()