compiler: don't set a structure to routine if it accidentally match some (bug #0018452)

git-svn-id: trunk@16747 -
This commit is contained in:
paul 2011-01-11 02:00:27 +00:00
parent fb943ef00b
commit f9f316ac45

View File

@ -915,9 +915,8 @@ implementation
(ttypesym(srsym).typedef.typ in [objectdef,recorddef]) then
begin
astruct:=tabstractrecorddef(ttypesym(srsym).typedef);
if (df_generic in astruct.defoptions) then
if (df_generic in astruct.defoptions) and try_to_consume(_LT) then
begin
consume(_LT);
ok:=true;
i:=0;
repeat
@ -954,13 +953,22 @@ implementation
consume(_GT);
end
else
if try_to_consume(_LT) then
if (df_generic in astruct.defoptions) and (token=_POINT) then
begin
Message(type_e_type_parameters_are_not_allowed_here);
repeat
consume(_ID);
until not try_to_consume(_COMMA);
consume(_GT);
Message1(type_e_generic_declaration_does_not_match,astruct.RttiName);
end
else
begin
{ not a method. routine name just accidentally match some structure name }
astruct:=nil;
if try_to_consume(_LT) then
begin
Message(type_e_type_parameters_are_not_allowed_here);
repeat
consume(_ID);
until not try_to_consume(_COMMA);
consume(_GT);
end;
end;
end;
end;