summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-10-15 11:50:12 +0200
committerAraq <rumpf_a@web.de>2018-10-15 11:50:12 +0200
commitbf01d7136eaa8ac545a4fb74869bfa5834917b3c (patch)
tree15f7010e43d924a37fc03e6caba3208ba52822fd /compiler/semstmts.nim
parent8252c65cf2501b8d6401e7d8295df374ef6b1994 (diff)
parent541c2a3fecd7b1f3e6d9dc7e23a7583000cb68f1 (diff)
downloadNim-bf01d7136eaa8ac545a4fb74869bfa5834917b3c.tar.gz
Merge branch 'Fixes-7845' of https://github.com/cooldome/Nim into cooldome-Fixes-7845
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index e02a38d8a..d2b866366 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -823,9 +823,10 @@ proc semRaise(c: PContext, n: PNode): PNode =
   checkSonsLen(n, 1, c.config)
   if n[0].kind != nkEmpty:
     n[0] = semExprWithType(c, n[0])
-    let typ = n[0].typ
+    var typ = n[0].typ
     if not isImportedException(typ, c.config):
-      if typ.kind != tyRef or typ.lastSon.kind != tyObject:
+      typ = typ.skipTypes({tyAlias, tyGenericInst})
+      if typ.kind != tyRef:
         localError(c.config, n.info, errExprCannotBeRaised)
       if typ.len > 0 and not isException(typ.lastSon):
         localError(c.config, n.info, "raised object of type $1 does not inherit from Exception",