summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-05-19 23:17:16 +0200
committerAraq <rumpf_a@web.de>2013-05-19 23:17:16 +0200
commit1c9b4e5d33ff6bca8f345951b72018171d47e251 (patch)
tree9ca5b48233aea847a8818c4efe50d927d42f18da /compiler
parent7b36d3d6ff390cc512be06a2c065108fc059eb6f (diff)
downloadNim-1c9b4e5d33ff6bca8f345951b72018171d47e251.tar.gz
made some tests green; implemented 'from module import nil'
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ccgutils.nim4
-rw-r--r--compiler/importer.nim4
-rw-r--r--compiler/semexprs.nim2
-rw-r--r--compiler/semstmts.nim8
4 files changed, 12 insertions, 6 deletions
diff --git a/compiler/ccgutils.nim b/compiler/ccgutils.nim
index 3dcec7d42..c37754511 100644
--- a/compiler/ccgutils.nim
+++ b/compiler/ccgutils.nim
@@ -86,7 +86,9 @@ proc GetUniqueType*(key: PType): PType =
     if result == nil:
       gCanonicalTypes[k] = key
       result = key
-  of tyGenericParam, tyTypeClass, tyTypeDesc:
+  of tyTypeDesc, tyTypeClass:
+    InternalError("value expected, but got a type")
+  of tyGenericParam:
     InternalError("GetUniqueType")
   of tyGenericInst, tyDistinct, tyOrdinal, tyMutable, tyConst, tyIter:
     result = GetUniqueType(lastSon(key))
diff --git a/compiler/importer.nim b/compiler/importer.nim
index ebb848ea7..7159072f7 100644
--- a/compiler/importer.nim
+++ b/compiler/importer.nim
@@ -157,7 +157,9 @@ proc evalFrom(c: PContext, n: PNode): PNode =
     var m = gImportModule(c.module, f)
     n.sons[0] = newSymNode(m)
     addDecl(c, m)               # add symbol to symbol table of module
-    for i in countup(1, sonsLen(n) - 1): importSymbol(c, n.sons[i], m)
+    for i in countup(1, sonsLen(n) - 1): 
+      if n.sons[i].kind != nkNilLit:
+        importSymbol(c, n.sons[i], m)
 
 proc evalImportExcept*(c: PContext, n: PNode): PNode = 
   result = n
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 2ffb9cd3a..e07821d1f 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -40,7 +40,7 @@ proc semExprWithType(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
     # do not produce another redundant error message:
     #raiseRecoverableError("")
     result = errorNode(c, n)
-  if result.typ == nil:
+  if result.typ == nil or result.typ == EnforceVoidContext:
     # we cannot check for 'void' in macros ...
     LocalError(n.info, errExprXHasNoType, 
                renderTree(result, {renderNoComments}))
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index f8ad1ff9e..b63c20548 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -89,9 +89,11 @@ 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 and 
-      c.p.owner.kind notin {skTemplate, skMacro}:
-    localError(n.info, errGenerated, "value expected, but got a type")
+  # This still breaks too many things:
+  when false:
+    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.} =  
   result = newNodeIT(nkHiddenDeref, n.info, n.typ.sons[0])