summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/semexprs.nim3
-rw-r--r--compiler/semstmts.nim3
-rw-r--r--compiler/semtypes.nim2
-rw-r--r--tests/reject/tenummix.nim2
-rw-r--r--tests/run/tcurrncy.nim2
-rw-r--r--tests/run/tvarargs_vs_generic.nim2
6 files changed, 8 insertions, 6 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index ed8ebfbb9..2ffb9cd3a 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -40,7 +40,8 @@ proc semExprWithType(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
     # do not produce another redundant error message:
     #raiseRecoverableError("")
     result = errorNode(c, n)
-  if isEmptyType(result.typ):
+  if result.typ == nil:
+    # we cannot check for 'void' in macros ...
     LocalError(n.info, errExprXHasNoType, 
                renderTree(result, {renderNoComments}))
     result.typ = errorType(c)
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 4e19fdde7..f8ad1ff9e 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -89,7 +89,8 @@ proc semDestructorCheck(c: PContext, n: PNode, flags: TExprFlags) {.inline.} =
     if instantiateDestructor(c, n.typ):
       LocalError(n.info, errGenerated,
         "usage of a type with a destructor in a non destructible context")
-  if efDetermineType notin flags and n.typ.kind == tyTypeDesc:
+  if efDetermineType notin flags and n.typ.kind == tyTypeDesc and 
+      c.p.owner.kind notin {skTemplate, skMacro}:
     localError(n.info, errGenerated, "value expected, but got a type")
 
 proc newDeref(n: PNode): PNode {.inline.} =  
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index cb46dad76..13cf44426 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -792,7 +792,7 @@ proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType =
       result = instGenericContainer(c, n, result)
 
 proc semTypeExpr(c: PContext, n: PNode): PType =
-  var n = semExprWithType(c, n)
+  var n = semExprWithType(c, n, {efDetermineType})
   if n.kind == nkSym and n.sym.kind == skType:
     result = n.sym.typ
   else:
diff --git a/tests/reject/tenummix.nim b/tests/reject/tenummix.nim
index 22c07f14a..f58e7989d 100644
--- a/tests/reject/tenummix.nim
+++ b/tests/reject/tenummix.nim
@@ -1,6 +1,6 @@
 discard """
   file: "system.nim"
-  line: 695
+  line: 696
   errormsg: "type mismatch"
 """
 
diff --git a/tests/run/tcurrncy.nim b/tests/run/tcurrncy.nim
index d04620cfb..78dbc2a89 100644
--- a/tests/run/tcurrncy.nim
+++ b/tests/run/tcurrncy.nim
@@ -10,7 +10,7 @@ template Additive(typ: typeDesc): stmt =
   proc `+` *(x: typ): typ {.borrow.}
   proc `-` *(x: typ): typ {.borrow.}
 
-template Multiplicative(typ, base: typeDesc): stmt =
+template Multiplicative(typ, base: typeDesc): stmt {.immediate.} =
   proc `*` *(x: typ, y: base): typ {.borrow.}
   proc `*` *(x: base, y: typ): typ {.borrow.}
   proc `div` *(x: typ, y: base): typ {.borrow.}
diff --git a/tests/run/tvarargs_vs_generic.nim b/tests/run/tvarargs_vs_generic.nim
index 7c1fa67b2..122f3e453 100644
--- a/tests/run/tvarargs_vs_generic.nim
+++ b/tests/run/tvarargs_vs_generic.nim
@@ -1,5 +1,5 @@
 discard """
-  output: "direct\nopenarray\nvarargs"
+  output: "direct\ngeneric\ngeneric"
 """
 
 proc withDirectType(args: string) =