The raises list can now use expressions referencing the generic params

This commit is contained in:
Zahary Karadjov 2020-04-01 04:01:25 +03:00 • committed by Andreas Rumpf
commit 08afa03075
4 changed files with 16 additions and 5 deletions

View file

@ -637,10 +637,13 @@ proc processPragma(c: PContext, n: PNode, i: int) =
proc pragmaRaisesOrTags(c: PContext, n: PNode) =
proc processExc(c: PContext, x: PNode) =
var t = skipTypes(c.semTypeNode(c, x, nil), skipPtrs)
if t.kind != tyObject:
localError(c.config, x.info, errGenerated, "invalid type for raises/tags list")
x.typ = t
if c.hasUnresolvedArgs(c, x):
x.typ = makeTypeFromExpr(c, x)
else:
var t = skipTypes(c.semTypeNode(c, x, nil), skipPtrs)
if t.kind != tyObject and not t.isMetaType:
localError(c.config, x.info, errGenerated, "invalid type for raises/tags list")
x.typ = t
if n.kind in nkPragmaCallKinds and n.len == 2:
let it = n[1]