summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/msgs.nim7
-rw-r--r--compiler/semcall.nim9
-rw-r--r--tests/enum/tenumitems.nim2
-rw-r--r--tests/misc/tissue710.nim2
-rw-r--r--tests/misc/tnoop.nim2
-rw-r--r--tests/modules/topaque.nim8
-rw-r--r--tests/tuples/twrongtupleaccess.nim2
7 files changed, 22 insertions, 10 deletions
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index e97032db4..de0caad79 100644
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -34,7 +34,9 @@ type
     errNoneSpeedOrSizeExpectedButXFound, errGuiConsoleOrLibExpectedButXFound,
     errUnknownOS, errUnknownCPU, errGenOutExpectedButXFound,
     errArgsNeedRunOption, errInvalidMultipleAsgn, errColonOrEqualsExpected,
-    errExprExpected, errUndeclaredIdentifier, errUseQualifier, errTypeExpected,
+    errExprExpected, errUndeclaredIdentifier, errUndeclaredField,
+    errUndeclaredProcedure, errUndeclaredProcedureField, errUseQualifier,
+    errTypeExpected,
     errSystemNeeds, errExecutionOfProgramFailed, errNotOverloadable,
     errInvalidArgForX, errStmtHasNoEffect, errXExpectsTypeOrValue,
     errXExpectsArrayType, errIteratorCannotBeInstantiated, errExprXAmbiguous,
@@ -190,6 +192,9 @@ const
     errColonOrEqualsExpected: "\':\' or \'=\' expected, but found \'$1\'",
     errExprExpected: "expression expected, but found \'$1\'",
     errUndeclaredIdentifier: "undeclared identifier: \'$1\'",
+    errUndeclaredField: "undeclared field: \'$1\'",
+    errUndeclaredProcedure: "attempting to call undeclared procedure: \'$1\'",
+    errUndeclaredProcedureField: "attempting to call undeclared procedure field: \'$1\'",
     errUseQualifier: "ambiguous identifier: \'$1\' -- use a qualifier",
     errTypeExpected: "type expected",
     errSystemNeeds: "system module needs \'$1\'",
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:
diff --git a/tests/enum/tenumitems.nim b/tests/enum/tenumitems.nim
index 04737fa9e..bebeb059f 100644
--- a/tests/enum/tenumitems.nim
+++ b/tests/enum/tenumitems.nim
@@ -1,6 +1,6 @@
 discard """
   line: 7
-  errormsg: "undeclared identifier: 'items'"
+  errormsg: "attempting to call undeclared procedure: 'items'"
 """
 
 type a = enum b,c,d
diff --git a/tests/misc/tissue710.nim b/tests/misc/tissue710.nim
index ecfdf653e..85b5e79a8 100644
--- a/tests/misc/tissue710.nim
+++ b/tests/misc/tissue710.nim
@@ -1,7 +1,7 @@
 discard """
   file: "tissue710.nim"
   line: 8
-  errorMsg: "undeclared identifier: '||'"
+  errorMsg: "attempting to call undeclared procedure: '||'"
 """
 var sum = 0
 for x in 3..1000:
diff --git a/tests/misc/tnoop.nim b/tests/misc/tnoop.nim
index 10c2eb2ec..50f750d60 100644
--- a/tests/misc/tnoop.nim
+++ b/tests/misc/tnoop.nim
@@ -1,7 +1,7 @@
 discard """
   file: "tnoop.nim"
   line: 11
-  errormsg: "undeclared identifier: 'a'"
+  errormsg: "attempting to call undeclared procedure: 'a'"
 """
 
 
diff --git a/tests/modules/topaque.nim b/tests/modules/topaque.nim
index f0587c959..84e2388bc 100644
--- a/tests/modules/topaque.nim
+++ b/tests/modules/topaque.nim
@@ -1,16 +1,16 @@
 discard """
   file: "topaque.nim"
   line: 16
-  errormsg: "undeclared identifier: \'buffer\'"
+  errormsg: "undeclared field: \'buffer\'"
 """
 # Test the new opaque types
 
-import 
+import
   mopaque
-  
+
 var
   L: TLexer
-  
+
 L.filename = "ha"
 L.line = 34
 L.buffer[0] = '\0' #ERROR_MSG undeclared field: 'buffer'
diff --git a/tests/tuples/twrongtupleaccess.nim b/tests/tuples/twrongtupleaccess.nim
index 1a9ae64a2..3ff967eea 100644
--- a/tests/tuples/twrongtupleaccess.nim
+++ b/tests/tuples/twrongtupleaccess.nim
@@ -1,7 +1,7 @@
 discard """
   file: "twrongtupleaccess.nim"
   line: 9
-  errormsg: "undeclared identifier: \'setBLAH\'"
+  errormsg: "attempting to call undeclared procedure field: \'setBLAH\'"
 """
 # Bugfix