summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-05-26 11:57:47 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-05-27 19:18:08 +0200
commit6ff66bfd519f076b5453b1bdcf94086b4ee658f4 (patch)
tree965ea0b0af0910ba6bb44d6fa6536122e8dd45d7 /compiler
parent04df004cd156917a850f61842992c43441f139ee (diff)
downloadNim-6ff66bfd519f076b5453b1bdcf94086b4ee658f4.tar.gz
improve error messages for mismatched templates involving 'untyped' and stmts
Diffstat (limited to 'compiler')
-rw-r--r--compiler/sigmatch.nim8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index ecef11d13..e72db45e7 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -242,6 +242,8 @@ proc argTypeToString(arg: PNode; prefer: TPreferedDesc): string =
     for i in 1 .. <arg.len:
       result.add(" | ")
       result.add typeToString(arg[i].typ, prefer)
+  elif arg.typ == nil:
+    result = "void"
   else:
     result = arg.typ.typeToString(prefer)
 
@@ -253,15 +255,15 @@ proc describeArgs*(c: PContext, n: PNode, startIdx = 1;
     if n.sons[i].kind == nkExprEqExpr:
       add(result, renderTree(n.sons[i].sons[0]))
       add(result, ": ")
-      if arg.typ.isNil:
+      if arg.typ.isNil and arg.kind notin {nkStmtList, nkDo}:
         arg = c.semOperand(c, n.sons[i].sons[1])
         n.sons[i].typ = arg.typ
         n.sons[i].sons[1] = arg
     else:
-      if arg.typ.isNil:
+      if arg.typ.isNil and arg.kind notin {nkStmtList, nkDo}:
         arg = c.semOperand(c, n.sons[i])
         n.sons[i] = arg
-    if arg.typ.kind == tyError: return
+    if arg.typ != nil and arg.typ.kind == tyError: return
     add(result, argTypeToString(arg, prefer))
     if i != sonsLen(n) - 1: add(result, ", ")