From c6d06111122f4519bc5a03319aa0ff89a6a60184 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Mon, 19 Aug 2013 01:34:40 +0300 Subject: [PATCH] Revert "Revert "made some tests green"" --- compiler/ast.nim | 3 +- compiler/lambdalifting.nim | 2 +- compiler/seminst.nim | 37 +++++++++------- compiler/semtypes.nim | 2 +- tests/compile/tobjects.nim | 86 +++++++++++++++++++------------------- tests/compile/toverprc.nim | 54 ++++++++++++------------ 6 files changed, 95 insertions(+), 89 deletions(-) diff --git a/compiler/ast.nim b/compiler/ast.nim index 5f6b658cfc..25c66e117b 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -1359,7 +1359,8 @@ proc getStrOrChar*(a: PNode): string = proc isGenericRoutine*(s: PSym): bool = case s.kind of skProc, skTemplate, skMacro, skIterator, skMethod, skConverter: - result = sfFromGeneric in s.flags + result = sfFromGeneric in s.flags or + (s.ast != nil and s.ast[genericParamsPos].kind != nkEmpty) else: nil proc isRoutine*(s: PSym): bool {.inline.} = diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim index 163ea41362..9a40b350e1 100644 --- a/compiler/lambdalifting.nim +++ b/compiler/lambdalifting.nim @@ -220,7 +220,7 @@ proc getHiddenParam(routine: PSym): PSym = proc isInnerProc(s, outerProc: PSym): bool {.inline.} = result = s.kind in {skProc, skMethod, skConverter} and - s.owner == outerProc and not isGenericRoutine(s) + s.owner == outerProc #s.typ.callConv == ccClosure proc addClosureParam(i: PInnerContext, e: PEnv) = diff --git a/compiler/seminst.nim b/compiler/seminst.nim index ed842d98ef..15be332610 100644 --- a/compiler/seminst.nim +++ b/compiler/seminst.nim @@ -91,17 +91,8 @@ proc instantiateBody(c: PContext, n: PNode, result: PSym) = addDecl(c, result) pushProcCon(c, result) # add params to scope - let origFormalParams = result.typ.n - result.typ.n = newNodeI(nkFormalParams, - origFormalParams.info, - origFormalParams.len) - result.typ.n.sons[0] = copyNode(origFormalParams.sons[0]) - for i in 1 ..