Merge pull request #680 from Varriount/core/fix-generic-crashes

Prevent lambdas from crashing if given implicit generic parameters.
This commit is contained in:
Andreas Rumpf 2013-11-19 02:34:22 -08:00
commit fb810e25c4

View file

@ -883,8 +883,9 @@ proc semLambda(c: PContext, n: PNode, flags: TExprFlags): PNode =
openScope(c) openScope(c)
if n.sons[genericParamsPos].kind != nkEmpty: if n.sons[genericParamsPos].kind != nkEmpty:
illFormedAst(n) # process parameters: illFormedAst(n) # process parameters:
if n.sons[paramsPos].kind != nkEmpty: if n.sons[paramsPos].kind != nkEmpty:
semParamList(c, n.sons[ParamsPos], nil, s) var gp = newNodeI(nkGenericParams, n.info)
semParamList(c, n.sons[ParamsPos], gp, s)
ParamsTypeCheck(c, s.typ) ParamsTypeCheck(c, s.typ)
else: else:
s.typ = newTypeS(tyProc, c) s.typ = newTypeS(tyProc, c)