void type for generics
This commit is contained in:
parent
05cffb9370
commit
00da785f5d
5 changed files with 27 additions and 13 deletions
|
|
@ -36,16 +36,6 @@ proc semExprWithType(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
|
|||
GlobalError(n.info, errExprXHasNoType,
|
||||
renderTree(result, {renderNoComments}))
|
||||
|
||||
proc semExprWithTypeNoDeref(c: PContext, n: PNode,
|
||||
flags: TExprFlags = {}): PNode =
|
||||
result = semExpr(c, n, flags)
|
||||
if result.kind == nkEmpty:
|
||||
# do not produce another redundant error message:
|
||||
raiseRecoverableError()
|
||||
if result.typ == nil:
|
||||
GlobalError(n.info, errExprXHasNoType,
|
||||
renderTree(result, {renderNoComments}))
|
||||
|
||||
proc semSymGenericInstantiation(c: PContext, n: PNode, s: PSym): PNode =
|
||||
result = symChoice(c, n, s)
|
||||
|
||||
|
|
|
|||
|
|
@ -581,8 +581,12 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode,
|
|||
addSon(result.n, newSymNode(arg))
|
||||
addSon(result, typ)
|
||||
if n.sons[0].kind != nkEmpty:
|
||||
result.sons[0] = paramType(c, n.sons[0], genericParams, cl)
|
||||
res.typ = result.sons[0]
|
||||
var r = paramType(c, n.sons[0], genericParams, cl)
|
||||
# turn explicit 'void' return type into 'nil' because the rest of the
|
||||
# compiler only checks for 'nil':
|
||||
if skipTypes(r, {tyGenericInst}).kind != tyEmpty:
|
||||
result.sons[0] = r
|
||||
res.typ = result.sons[0]
|
||||
|
||||
proc semStmtListType(c: PContext, n: PNode, prev: PType): PType =
|
||||
checkMinSonsLen(n, 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue