summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--tests/effects/teffects9.nim22
-rw-r--r--tests/generics/tgeneric0.nim13
-rw-r--r--tests/notnil/tmust_compile.nim10
3 files changed, 45 insertions, 0 deletions
diff --git a/tests/effects/teffects9.nim b/tests/effects/teffects9.nim
new file mode 100644
index 000000000..d92668fe9
--- /dev/null
+++ b/tests/effects/teffects9.nim
@@ -0,0 +1,22 @@
+discard """
+  errormsg: "can raise an unlisted exception: ref Exception"
+  line: 16
+"""
+
+# bug #8481
+
+type
+  ParentObj = ref object of RootObj
+  DerivedObj = ref object of ParentObj
+
+method doSome(o: ParentObj) {.base, raises: [].} =
+  discard
+
+method doSome(o: DerivedObj) =
+  raise newException(Exception, "oops, this raised")
+
+proc thisRaises() {.raises: [].} =
+  let o = new(DerivedObj)
+  o.doSome()
+
+thisRaises()
diff --git a/tests/generics/tgeneric0.nim b/tests/generics/tgeneric0.nim
index ae4820f57..44c34917d 100644
--- a/tests/generics/tgeneric0.nim
+++ b/tests/generics/tgeneric0.nim
@@ -140,3 +140,16 @@ var res = Resource(name: "Resource 1")
 
 (proc (r: typeof(res)) =
    echo r[])(res)
+
+# bug #4061
+
+type List[T] = object
+  e: T
+  n: ptr List[T]
+
+proc zip*[T,U](xs: List[T], ys: List[U]): List[(T,U)] = discard
+
+proc unzip*[T,U](xs: List[tuple[t: T, u: U]]): (List[T], List[U]) = discard
+
+proc unzip2*[T,U](xs: List[(T,U)]): (List[T], List[U]) = discard
+
diff --git a/tests/notnil/tmust_compile.nim b/tests/notnil/tmust_compile.nim
index d09dda057..3a013e9ed 100644
--- a/tests/notnil/tmust_compile.nim
+++ b/tests/notnil/tmust_compile.nim
@@ -63,3 +63,13 @@ proc parse(cts: CTS, jn: JsonNode) =
 
 proc p(x: proc(){.closure.} not nil) = discard
 p(proc(){.closure.} = discard)
+
+# bug #6490
+
+proc p2(a: proc()) =
+    if a.isNil:
+        raise newException(ValueError, "a is nil")
+    else:
+        let b: proc() not nil = a
+
+p2(writeStackTrace)