diff options
author | Clay Sweetser <clay.sweetser@gmail.com> | 2013-11-14 12:32:35 -0500 |
---|---|---|
committer | Clay Sweetser <clay.sweetser@gmail.com> | 2013-11-18 17:26:53 -0500 |
commit | f279d465d0a9499825efba93ee189b5cc279e064 (patch) | |
tree | de17faf26f05507df1886611cebeb4eb132e4a38 /compiler/semstmts.nim | |
parent | 9061b8961eb5cefd31eba9314a5932f35f524eac (diff) | |
download | Nim-f279d465d0a9499825efba93ee189b5cc279e064.tar.gz |
Prevent lambdas from crashing if given implicit generic parameters.
Fixes issues #599 and #641 (and possibly other generic-related issues)
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r-- | compiler/semstmts.nim | 5 |
1 files changed, 3 insertions, 2 deletions
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) |