From f279d465d0a9499825efba93ee189b5cc279e064 Mon Sep 17 00:00:00 2001 From: Clay Sweetser Date: Thu, 14 Nov 2013 12:32:35 -0500 Subject: Prevent lambdas from crashing if given implicit generic parameters. Fixes issues #599 and #641 (and possibly other generic-related issues) --- compiler/semstmts.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'compiler') diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index ed6787a16..3752739bf 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -879,8 +879,9 @@ proc semLambda(c: PContext, n: PNode, flags: TExprFlags): PNode = openScope(c) if n.sons[genericParamsPos].kind != nkEmpty: illFormedAst(n) # process parameters: - if n.sons[paramsPos].kind != nkEmpty: - semParamList(c, n.sons[ParamsPos], nil, s) + if n.sons[paramsPos].kind != nkEmpty: + var gp = newNodeI(nkGenericParams, n.info) + semParamList(c, n.sons[ParamsPos], gp, s) ParamsTypeCheck(c, s.typ) else: s.typ = newTypeS(tyProc, c) -- cgit 1.4.1-2-gfad0