* better error messages for non-overloadable operators:

* only suggest = if the user tried to overload <>
    * suggest ** if the user tried to overload ^ (mantis #9606)
    * no suggestion otherwise
   (instead of always suggesting '=')

git-svn-id: trunk@8402 -
This commit is contained in:
Jonas Maebe 2007-09-08 10:49:16 +00:00
parent 148255b5cf
commit 91629f810f
5 changed files with 280 additions and 273 deletions

View File

@ -638,7 +638,7 @@ parser_e_no_new_or_dispose_for_classes=03086_E_The extended syntax of new or dis
parser_e_procedure_overloading_is_off=03088_E_Procedure overloading is switched off
% When using the \var{-So} switch, procedure overloading is switched off.
% Turbo Pascal does not support function overloading.
parser_e_overload_operator_failed=03089_E_It is not possible to overload this operator (overload = instead)
parser_e_overload_operator_failed=03089_E_It is not possible to overload this operator. Related overloadable operators (if any) are: $1
% You are trying to overload an operator which cannot be overloaded.
% The following operators can be overloaded :
% \begin{verbatim}

View File

@ -731,7 +731,7 @@ const
option_info=11024;
option_help_pages=11025;
MsgTxtSize = 45039;
MsgTxtSize = 45067;
MsgIdxMax : array[1..20] of longint=(
24,86,237,83,63,49,107,22,135,60,

File diff suppressed because it is too large Load Diff

View File

@ -1055,7 +1055,14 @@ implementation
end
else
begin
Message(parser_e_overload_operator_failed);
case token of
_CARET:
Message1(parser_e_overload_operator_failed,'**');
_UNEQUAL:
Message1(parser_e_overload_operator_failed,'=');
else
Message1(parser_e_overload_operator_failed,'');
end;
{ Use the dummy NOTOKEN that is also declared
for the overloaded_operator[] }
optoken:=NOTOKEN;

View File

@ -3498,7 +3498,7 @@ In case not, the value returned can be arbitrary.
readchar;
c:=upcase(c);
if (block_type in [bt_type,bt_specialize]) or
(lasttoken=_ID) or (lasttoken=_NIL) or
(lasttoken=_ID) or (lasttoken=_NIL) or (lasttoken=_OPERATOR) or
(lasttoken=_RKLAMMER) or (lasttoken=_RECKKLAMMER) or (lasttoken=_CARET) then
begin
token:=_CARET;