summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-08-04 19:36:13 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-08-04 19:36:13 +0200
commit5d5636138377b63c4b7357ff40048b65a8dcd054 (patch)
tree1fdbe8a08ebac16fe3b21316a5681945a0a283d8 /compiler
parent4a96a3d9a1011c7023a45bb9f921a339aea0e3f7 (diff)
downloadNim-5d5636138377b63c4b7357ff40048b65a8dcd054.tar.gz
fixes #4353
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semexprs.nim4
-rw-r--r--compiler/semtempl.nim10
2 files changed, 9 insertions, 5 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index fd18dc3d7..fc31829ba 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -2216,7 +2216,9 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
   if nfSem in n.flags: return
   case n.kind
   of nkIdent, nkAccQuoted:
-    var s = lookUp(c, n)
+    let checks = if efNoEvaluateGeneric in flags: {checkUndeclared}
+                 else: {checkUndeclared, checkModule, checkAmbiguity}
+    var s = qualifiedLookUp(c, n, checks)
     if c.inTypeClass == 0: semCaptureSym(s, c.p.owner)
     result = semSym(c, n, s, flags)
     if s.kind in {skProc, skMethod, skConverter, skIterator}:
diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim
index 4d3b6d038..20b5071ac 100644
--- a/compiler/semtempl.nim
+++ b/compiler/semtempl.nim
@@ -51,9 +51,10 @@ proc symChoice(c: PContext, n: PNode, s: PSym, r: TSymChoiceRule): PNode =
   var i = 0
   a = initOverloadIter(o, c, n)
   while a != nil:
+    if a.kind != skModule:
+      inc(i)
+      if i > 1: break
     a = nextOverloadIter(o, c, n)
-    inc(i)
-    if i > 1: break
   if i <= 1 and r != scForceOpen:
     # XXX this makes more sense but breaks bootstrapping for now:
     # (s.kind notin routineKinds or s.magic != mNone):
@@ -68,8 +69,9 @@ proc symChoice(c: PContext, n: PNode, s: PSym, r: TSymChoiceRule): PNode =
     result = newNodeIT(kind, n.info, newTypeS(tyNone, c))
     a = initOverloadIter(o, c, n)
     while a != nil:
-      incl(a.flags, sfUsed)
-      addSon(result, newSymNode(a, n.info))
+      if a.kind != skModule:
+        incl(a.flags, sfUsed)
+        addSon(result, newSymNode(a, n.info))
       a = nextOverloadIter(o, c, n)
 
 proc semBindStmt(c: PContext, n: PNode, toBind: var IntSet): PNode =