the regression was caused by the introduction of "generic" lambdas
This commit is contained in:
Zahary Karadjov 2014-03-15 11:23:46 +02:00
commit cf8fe16a48
6 changed files with 29 additions and 4 deletions

View file

@ -944,13 +944,15 @@ proc semLambda(c: PContext, n: PNode, flags: TExprFlags): PNode =
localError(n.sons[bodyPos].info, errImplOfXNotAllowed, s.name.s)
#if efDetermineType notin flags:
# XXX not good enough; see tnamedparamanonproc.nim
if n.sons[genericParamsPos].kind == nkEmpty:
if gp.len == 0 or (gp.len == 1 and tfRetType in gp[0].typ.flags):
pushProcCon(c, s)
addResult(c, s.typ.sons[0], n.info, skProc)
let semBody = hloBody(c, semProcBody(c, n.sons[bodyPos]))
n.sons[bodyPos] = transformBody(c.module, semBody, s)
addResultNode(c, n)
popProcCon(c)
elif efOperand notin flags:
localError(n.info, errGenericLambdaNotAllowed)
sideEffectsCheck(c, s)
else:
localError(n.info, errImplOfXexpected, s.name.s)