summary refs log tree commit diff stats
path: root/compiler/semcall.nim
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2015-06-04 13:55:48 +0100
committerDominik Picheta <dominikpicheta@googlemail.com>2015-06-04 13:55:48 +0100
commit22f6017ab89e2fa7101c72e05a7703a83f1385d6 (patch)
tree8ce21bad48d7a9cbe37a49a09e600dd66d02e0b2 /compiler/semcall.nim
parentccb9ae2d52cc42f2489a7bbd758c924a4dbbe872 (diff)
downloadNim-22f6017ab89e2fa7101c72e05a7703a83f1385d6.tar.gz
Fixes #2584
Better compiler errors for accessing undeclared fields, calling undeclared
procedures and procedure fields.
Diffstat (limited to 'compiler/semcall.nim')
-rw-r--r--compiler/semcall.nim9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/semcall.nim b/compiler/semcall.nim
index c48e761e3..342397740 100644
--- a/compiler/semcall.nim
+++ b/compiler/semcall.nim
@@ -209,7 +209,14 @@ proc resolveOverloads(c: PContext, n, orig: PNode,
       pickBest(callOp)
 
     if overloadsState == csEmpty and result.state == csEmpty:
-      localError(n.info, errUndeclaredIdentifier, considerQuotedIdent(f).s)
+      if nfDotField in n.flags:
+        if nfExplicitCall in n.flags:
+          localError(n.info, errUndeclaredProcedureField,
+              considerQuotedIdent(f).s)
+        else:
+          localError(n.info, errUndeclaredField, considerQuotedIdent(f).s)
+      else:
+        localError(n.info, errUndeclaredProcedure, considerQuotedIdent(f).s)
       return
     elif result.state != csMatch:
       if nfExprCall in n.flags: