summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2013-12-29 00:00:37 +0200
committerZahary Karadjov <zahary@gmail.com>2013-12-29 00:00:37 +0200
commit66a255652572b48440b68878e99d7f5290e384b3 (patch)
tree3349b1791218a3416209569848244245e087009d /compiler/semstmts.nim
parenteb1d23c0c745c64225e8db22f62d8ebf596f4448 (diff)
downloadNim-66a255652572b48440b68878e99d7f5290e384b3.tar.gz
make more tests green
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index a1805fdec..33e942844 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -1039,8 +1039,12 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
     # for DLL generation it is annoying to check for sfImportc!
     if sfBorrow in s.flags: 
       LocalError(n.sons[bodyPos].info, errImplOfXNotAllowed, s.name.s)
-    if n.sons[genericParamsPos].kind == nkEmpty: 
-      ParamsTypeCheck(c, s.typ)
+    let usePseudoGenerics = kind in {skMacro, skTemplate}
+    # Macros and Templates can have generic parameters, but they are
+    # only used for overload resolution (there is no instantiation of
+    # the symbol, so we must process the body now)
+    if n.sons[genericParamsPos].kind == nkEmpty or usePseudoGenerics:
+      if not usePseudoGenerics: ParamsTypeCheck(c, s.typ)
       pushProcCon(c, s)
       maybeAddResult(c, s, n)
       if sfImportc notin s.flags: