Merge branch 'Fixes-7845' of https://github.com/cooldome/Nim into cooldome-Fixes-7845
This commit is contained in:
commit
bf01d7136e
3 changed files with 23 additions and 8 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue