diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-01-05 10:20:24 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-01-05 10:20:24 +0100 |
commit | 1a2bda45ec11d6d0fcba4ba61114c352ae66d4de (patch) | |
tree | 8f442e1b7ad75c7d515312eed77c960a27c086f4 /compiler | |
parent | 164ebb6762022581e8b77b888d138de3aaf5561e (diff) | |
download | Nim-1a2bda45ec11d6d0fcba4ba61114c352ae66d4de.tar.gz |
fixes #2007
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/lambdalifting.nim | 4 | ||||
-rw-r--r-- | compiler/semstmts.nim | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim index acc291a5b..dfd5e740e 100644 --- a/compiler/lambdalifting.nim +++ b/compiler/lambdalifting.nim @@ -162,9 +162,9 @@ proc addHiddenParam(routine: PSym, param: PSym) = # some nkEffect node: param.position = routine.typ.n.len-1 addSon(params, newSymNode(param)) - incl(routine.typ.flags, tfCapturesEnv) + #incl(routine.typ.flags, tfCapturesEnv) assert sfFromGeneric in param.flags - #echo "produced environment: ", param.id, " for ", routine.name.s + #echo "produced environment: ", param.id, " for ", routine.id proc getHiddenParam(routine: PSym): PSym = let params = routine.ast.sons[paramsPos] diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 76d224a87..1340abd10 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -958,15 +958,17 @@ proc semInferredLambda(c: PContext, pt: TIdTable, n: PNode): PNode = var n = n let original = n.sons[namePos].sym - let s = copySym(original, false) - incl(s.flags, sfFromGeneric) + let s = original #copySym(original, false) + #incl(s.flags, sfFromGeneric) + #s.owner = original n = replaceTypesInBody(c, pt, n, original) result = n s.ast = result n.sons[namePos].sym = s n.sons[genericParamsPos] = emptyNode - let params = n.typ.n + # for LL we need to avoid wrong aliasing + let params = copyTree n.typ.n n.sons[paramsPos] = params s.typ = n.typ for i in 1..<params.len: @@ -974,6 +976,7 @@ proc semInferredLambda(c: PContext, pt: TIdTable, n: PNode): PNode = tyFromExpr, tyFieldAccessor}+tyTypeClasses: localError(params[i].info, "cannot infer type of parameter: " & params[i].sym.name.s) + #params[i].sym.owner = s openScope(c) pushOwner(s) addParams(c, params, skProc) |