# revisions: 42328,42329

git-svn-id: branches/fixes_3_2@43401 -
This commit is contained in:
marco 2019-11-05 16:22:23 +00:00
parent 89e051bac9
commit c4b9529d6b
4 changed files with 48 additions and 1 deletions

1
.gitattributes vendored
View File

@ -16443,6 +16443,7 @@ tests/webtbs/tw3564.pp svneol=native#text/plain
tests/webtbs/tw3567.pp svneol=native#text/plain tests/webtbs/tw3567.pp svneol=native#text/plain
tests/webtbs/tw3572.pp svneol=native#text/plain tests/webtbs/tw3572.pp svneol=native#text/plain
tests/webtbs/tw3573.pp svneol=native#text/plain tests/webtbs/tw3573.pp svneol=native#text/plain
tests/webtbs/tw35735.pp svneol=native#text/pascal
tests/webtbs/tw3576.pp svneol=native#text/plain tests/webtbs/tw3576.pp svneol=native#text/plain
tests/webtbs/tw3577.pp svneol=native#text/plain tests/webtbs/tw3577.pp svneol=native#text/plain
tests/webtbs/tw3578.pp svneol=native#text/plain tests/webtbs/tw3578.pp svneol=native#text/plain

View File

@ -1259,7 +1259,10 @@ implementation
begin begin
if (idtoken=_GENERIC) and if (idtoken=_GENERIC) and
not (m_delphi in current_settings.modeswitches) and not (m_delphi in current_settings.modeswitches) and
not fields_allowed then (
not fields_allowed or
is_objectpascal_helper(current_structdef)
) then
begin begin
if hadgeneric then if hadgeneric then
Message(parser_e_procedure_or_function_expected); Message(parser_e_procedure_or_function_expected);

View File

@ -1050,6 +1050,16 @@ implementation
HideSym(srsym); HideSym(srsym);
searchagain:=true; searchagain:=true;
end end
else if (srsym.typ=typesym) and
(sp_generic_dummy in srsym.symoptions) and
(ttypesym(srsym).typedef.typ=undefineddef) then
begin
{ this is a generic dummy symbol that has not yet
been used; so we rename the dummy symbol and continue
as if nothing happened }
hidesym(srsym);
searchagain:=true;
end
else else
begin begin
{ we use a different error message for tp7 so it looks more compatible } { we use a different error message for tp7 so it looks more compatible }

33
tests/webtbs/tw35735.pp Normal file
View File

@ -0,0 +1,33 @@
{ %NORUN }
program tw35735;
{$Mode objfpc}
uses
Classes, SysUtils;
type
{ TObjectHelper }
TObjectHelper = class helper for TObject
public
generic function Test<T>(): String;
end;
{ TComponentHelper }
generic function TObjectHelper.Test<T>: String;
begin
Result := T.ClassName
end;
var
O: TObject;
begin
O := TObject.Create;
WriteLn(O.specialize Test<TPersistent>);
O.Free;
end.