summary refs log tree commit diff stats
path: root/tests/notnil/tmust_compile.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/notnil/tmust_compile.nim')
-rw-r--r--tests/notnil/tmust_compile.nim24
1 files changed, 10 insertions, 14 deletions
diff --git a/tests/notnil/tmust_compile.nim b/tests/notnil/tmust_compile.nim
index a32c6c7ec..3a013e9ed 100644
--- a/tests/notnil/tmust_compile.nim
+++ b/tests/notnil/tmust_compile.nim
@@ -44,16 +44,16 @@ import json
 type
 
   foo = object
-    thing: string not nil
+    thing: ptr int not nil
 
   CTS = ref object
     subs_by_sid: Table[int, foo]
 
 
 proc parse(cts: CTS, jn: JsonNode) =
-
+  var y = jn.getInt(4523)
   let ces = foo(
-    thing: jn.getStr("thing")
+    thing: addr y
   )
 
   cts.subs_by_sid[0] = ces
@@ -64,16 +64,12 @@ proc parse(cts: CTS, jn: JsonNode) =
 proc p(x: proc(){.closure.} not nil) = discard
 p(proc(){.closure.} = discard)
 
-# bug #3993
-
-type
-  List[T] = seq[T] not nil
-
-proc `^^`[T](v: T, lst: List[T]): List[T] =
-  result = @[v]
-  result.add(lst)
+# bug #6490
 
-proc Nil[T](): List[T] = @[]
+proc p2(a: proc()) =
+    if a.isNil:
+        raise newException(ValueError, "a is nil")
+    else:
+        let b: proc() not nil = a
 
-when isMainModule:
-  let lst = 1 ^^ 2 ^^ Nil[int]()
+p2(writeStackTrace)