summary refs log tree commit diff stats
path: root/compiler/semexprs.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2014-03-16 18:34:37 +0200
committerZahary Karadjov <zahary@gmail.com>2014-03-16 20:42:49 +0200
commit49b0440c47b1f22bf2b84083b0c2b79fb60fdfd5 (patch)
treecc3e9612054ebcad226d0f7bffc3237d62d30005 /compiler/semexprs.nim
parentf0953db3ba59f2e23df2fb7932c672f5020db5fb (diff)
downloadNim-49b0440c47b1f22bf2b84083b0c2b79fb60fdfd5.tar.gz
make some tests green
Diffstat (limited to 'compiler/semexprs.nim')
-rw-r--r--compiler/semexprs.nim10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 2c7408047..7e141cb24 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -325,8 +325,13 @@ proc isOpImpl(c: PContext, n: PNode): PNode =
                                         tfIterator notin t.flags))
   else:
     var t2 = n[2].typ.skipTypes({tyTypeDesc})
+    # XXX: liftParamType started to perform addDecl
+    # we could do that instead in semTypeNode by snooping for added
+    # gnrc. params, then it won't be necessary to open a new scope here
+    openScope(c)
     let lifted = liftParamType(c, skType, newNodeI(nkArgList, n.info),
                                t2, ":anon", n.info)
+    closeScope(c)
     if lifted != nil: t2 = lifted
     var m: TCandidate
     initCandidate(c, m, t2)
@@ -1257,8 +1262,9 @@ proc semProcBody(c: PContext, n: PNode): PNode =
       result = semAsgn(c, a)
   else:
     discardCheck(c, result)
-
-  if c.p.resultSym != nil and c.p.resultSym.typ.isMetaType:
+  
+  if c.p.owner.kind notin {skMacro, skTemplate} and
+     c.p.resultSym != nil and c.p.resultSym.typ.isMetaType:
     localError(c.p.resultSym.info, errCannotInferReturnType)
 
   closeScope(c)