* give an error when trying to let an objcclass conform to a

forward-declared objcprotocol (mantis #17341)

git-svn-id: trunk@16523 -
This commit is contained in:
Jonas Maebe 2010-12-08 22:17:24 +00:00
parent a880603816
commit 3a089cea10
6 changed files with 405 additions and 371 deletions

1
.gitattributes vendored
View File

@ -10073,6 +10073,7 @@ tests/webtbf/tw1633.pp svneol=native#text/plain
tests/webtbf/tw1642.pp svneol=native#text/plain
tests/webtbf/tw1655.pp svneol=native#text/plain
tests/webtbf/tw1681.pp svneol=native#text/plain
tests/webtbf/tw17341.pp svneol=native#text/plain
tests/webtbf/tw17455.pp svneol=native#text/plain
tests/webtbf/tw1754.pp svneol=native#text/plain
tests/webtbf/tw1754b.pp svneol=native#text/plain

View File

@ -368,7 +368,7 @@ scanner_w_illegal_warn_identifier=02087_W_Illegal identifier "$1" for $WARN dire
#
# Parser
#
# 03296 is the last used one
# 03298 is the last used one
#
% \section{Parser messages}
% This section lists all parser messages. The parser takes care of the
@ -1341,6 +1341,16 @@ parser_f_no_generic_inside_generic=03297_F_Declaration of generic class inside a
% (guarded by internal error 200511173 in tscannerfile.startrecordtokens).
% Since generics are implemented by recording tokens, it is not possible to
% have declaration of generic class inside another generic class.
parser_e_forward_protocol_declaration_must_be_resolved=03298_E_Forward declaration of objcprotocol "$1" must be resolved before an objcclass can conform to it
% An objcprotocol must be fully defined before classes can conform to it.
% This error occurs in the following situation:
% \begin{verbatim}
% Type MyProtocol = objcprotoocl;
% ChildClass = Class(NSObject,MyProtocol)
% ...
% end;
% \end{verbatim}
% where \var{MyProtocol} is declared but not defined.
% \end{description}
#
# Type Checking

View File

@ -386,6 +386,7 @@ const
parser_e_objc_missing_enumeration_defs=03295;
parser_e_no_procvarnested_const=03296;
parser_f_no_generic_inside_generic=03297;
parser_e_forward_protocol_declaration_must_be_resolved=03298;
type_e_mismatch=04000;
type_e_incompatible_types=04001;
type_e_not_equal_types=04002;
@ -871,9 +872,9 @@ const
option_info=11024;
option_help_pages=11025;
MsgTxtSize = 57905;
MsgTxtSize = 58009;
MsgIdxMax : array[1..20] of longint=(
24,88,298,97,82,54,111,22,202,63,
24,88,299,97,82,54,111,22,202,63,
49,20,1,1,1,1,1,1,1,1
);

File diff suppressed because it is too large Load Diff

View File

@ -277,6 +277,11 @@ implementation
Message1(type_e_protocol_type_expected,intfdef.typename);
exit;
end;
if (oo_is_forward in intfdef.objectoptions) then
begin
Message1(parser_e_forward_protocol_declaration_must_be_resolved,intfdef.objrealname^);
exit;
end;
if current_objectdef.find_implemented_interface(intfdef)<>nil then
Message1(sym_e_duplicate_id,intfdef.objname^)
else

17
tests/webtbf/tw17341.pp Normal file
View File

@ -0,0 +1,17 @@
{ %fail }
{ %target=darwin }
{ %cpu=powerpc,powerpc64,i386,x86_64,arm }
{$mode objfpc}
{$modeswitch objectivec1}
type
tmyprotocol = objcprotocol;
tmyclass = objcclass(NSObject,tmyprotocol)
end;
tmyprotocol = objcprotocol
end;
begin
end.