summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorcooldome <ariabushenko@bk.ru>2018-06-10 22:49:09 +0100
committercooldome <ariabushenko@bk.ru>2018-06-10 22:49:09 +0100
commit7302a8ce7a0cc566c098b29fdb73c5da3b8e6ac0 (patch)
tree071c466a780b598876525f3799b5e5a9e3fdd7d2 /compiler/semstmts.nim
parent03653ab61e6eed6811c5df0677a2bf2aa722ef9c (diff)
downloadNim-7302a8ce7a0cc566c098b29fdb73c5da3b8e6ac0.tar.gz
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 7213601de..12337262a 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -755,9 +755,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 not isException(typ.lastSon):
         localError(c.config, n.info, "raised object of type $1 does not inherit from Exception",