summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2013-08-27 00:08:47 +0300
committerZahary Karadjov <zahary@gmail.com>2013-08-27 00:08:47 +0300
commitdc33638cb256fa47ab723d991e85b746fc690d59 (patch)
tree2251b6a0f3b72de49951302f59e931df97f51587 /compiler
parentbdeaee4a331de99d964386682f49de213b7d7d87 (diff)
downloadNim-dc33638cb256fa47ab723d991e85b746fc690d59.tar.gz
proper discrimination between csEmpty and csNoMatch
fixes twrongtupleaccess and topaque
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semcall.nim11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/semcall.nim b/compiler/semcall.nim
index 643eef065..c7f4e4387 100644
--- a/compiler/semcall.nim
+++ b/compiler/semcall.nim
@@ -50,7 +50,8 @@ proc
   if sym == nil: return
   initCandidate(best, sym, initialBinding, symScope)
   initCandidate(alt, sym, initialBinding, symScope)
-
+  best.state = csNoMatch
+  
   while sym != nil:
     if sym.kind in filter:
       determineType(c, sym)
@@ -115,7 +116,8 @@ proc resolveOverloads(c: PContext, n, orig: PNode,
 
   pickBest(f)
 
-  if result.state == csEmpty:
+  let overloadsState = result.state
+  if overloadsState != csMatch:
     if nfDelegate in n.flags:
       InternalAssert f.kind == nkIdent
       let calleeName = newStrNode(nkStrLit, f.ident.s)
@@ -127,7 +129,10 @@ proc resolveOverloads(c: PContext, n, orig: PNode,
      
       pickBest(callOp)
 
-    if result.state == csEmpty:
+    if overloadsState == csEmpty and result.state == csEmpty:
+      LocalError(n.info, errUndeclaredIdentifier, considerAcc(f).s)
+      return
+    elif result.state != csMatch:
       if nfExprCall in n.flags:
         if c.inCompilesContext > 0 or gErrorCounter == 0:
           LocalError(n.info, errExprXCannotBeCalled,