diff --git a/compiler/msgs.nim b/compiler/msgs.nim index e97032db4f..81a62371e2 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, + errUndeclaredRoutine, errUseQualifier, + errTypeExpected, errSystemNeeds, errExecutionOfProgramFailed, errNotOverloadable, errInvalidArgForX, errStmtHasNoEffect, errXExpectsTypeOrValue, errXExpectsArrayType, errIteratorCannotBeInstantiated, errExprXAmbiguous, @@ -190,6 +192,8 @@ const errColonOrEqualsExpected: "\':\' or \'=\' expected, but found \'$1\'", errExprExpected: "expression expected, but found \'$1\'", errUndeclaredIdentifier: "undeclared identifier: \'$1\'", + errUndeclaredField: "undeclared field: \'$1\'", + errUndeclaredRoutine: "attempting to call undeclared routine: \'$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 c48e761e35..571504c3a4 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -209,7 +209,10 @@ 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 and nfExplicitCall notin n.flags: + localError(n.info, errUndeclaredField, considerQuotedIdent(f).s) + else: + localError(n.info, errUndeclaredRoutine, 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 04737fa9ea..38233aad7f 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 routine: 'items'" """ type a = enum b,c,d diff --git a/tests/misc/tissue710.nim b/tests/misc/tissue710.nim index ecfdf653ef..3b6d3e5f35 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 routine: '||'" """ var sum = 0 for x in 3..1000: diff --git a/tests/misc/tnoop.nim b/tests/misc/tnoop.nim index 10c2eb2ec0..1e3fbe6cfd 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 routine: 'a'" """ diff --git a/tests/modules/topaque.nim b/tests/modules/topaque.nim index f0587c959f..84e2388bcb 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 1a9ae64a24..b1684b0977 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 routine: \'setBLAH\'" """ # Bugfix