* fix for Mantis #23071: also store local symtable in the PPU if the procdef is generic as we need it to resolve genericdefs to nested types

git-svn-id: trunk@42459 -
This commit is contained in:
svenbarth 2019-07-19 15:55:28 +00:00
parent 4d6844e731
commit 43b5dbf613
4 changed files with 57 additions and 16 deletions

2
.gitattributes vendored
View File

@ -15980,6 +15980,7 @@ tests/webtbs/tw2300.pp svneol=native#text/plain
tests/webtbs/tw2305.pp svneol=native#text/plain
tests/webtbs/tw2306.pp svneol=native#text/plain
tests/webtbs/tw2307.pp svneol=native#text/plain
tests/webtbs/tw23071.pp svneol=native#text/pascal
tests/webtbs/tw23109.pp svneol=native#text/plain
tests/webtbs/tw2311.pp svneol=native#text/plain
tests/webtbs/tw23130.pp svneol=native#text/pascal
@ -17224,6 +17225,7 @@ tests/webtbs/uw2266b.pas svneol=native#text/plain
tests/webtbs/uw2269.inc svneol=native#text/plain
tests/webtbs/uw22741a.pp svneol=native#text/plain
tests/webtbs/uw22741b.pp svneol=native#text/plain
tests/webtbs/uw23071.pp svneol=native#text/pascal
tests/webtbs/uw23204.pp svneol=native#text/plain
tests/webtbs/uw2364.pp svneol=native#text/plain
tests/webtbs/uw25054a.pp svneol=native#text/pascal

View File

@ -773,6 +773,8 @@ interface
procdef has been handled }
implprocdefinfo : pimplprocdefinfo;
function store_localst:boolean;
function GetResultName: PShortString;
procedure SetResultName(AValue: PShortString);
function GetParentFPStruct: tsym;
@ -5716,6 +5718,13 @@ implementation
TPROCDEF
***************************************************************************}
function tprocdef.store_localst: boolean;
begin
result:=has_inlininginfo or (df_generic in defoptions);
end;
function tprocdef.GetResultName: PShortString;
begin
if not assigned(implprocdefinfo) then
@ -6039,7 +6048,7 @@ implementation
parast:=tparasymtable.create(self,level);
tparasymtable(parast).ppuload(ppufile);
{ load local symtable }
if has_inlininginfo then
if store_localst then
begin
localst:=tlocalsymtable.create(self,level);
tlocalsymtable(localst).ppuload(ppufile);
@ -6221,7 +6230,7 @@ implementation
{ save localsymtable for inline procedures or when local
browser info is requested, this has no influence on the crc }
if has_inlininginfo then
if store_localst and not ppufile.crc_only then
begin
oldintfcrc:=ppufile.do_crc;
ppufile.do_crc:=false;
@ -6512,16 +6521,16 @@ implementation
begin
inherited buildderefimpl;
{ Localst is not available for main/unit init }
if store_localst and assigned(localst) then
begin
tlocalsymtable(localst).buildderef;
tlocalsymtable(localst).buildderefimpl;
end;
{ inline tree }
if has_inlininginfo then
begin
{ Localst is not available for main/unit init }
if assigned(localst) then
begin
tlocalsymtable(localst).buildderef;
tlocalsymtable(localst).buildderefimpl;
end;
funcretsymderef.build(funcretsym);
inlininginfo^.code.buildderefimpl;
end;
@ -6546,16 +6555,16 @@ implementation
if assigned(inlininginfo) then
has_inlininginfo:=true;
{ Locals }
if store_localst and assigned(localst) then
begin
tlocalsymtable(localst).deref(false);
tlocalsymtable(localst).derefimpl(false);
end;
{ Inline }
if has_inlininginfo then
begin
{ Locals }
if assigned(localst) then
begin
tlocalsymtable(localst).deref(false);
tlocalsymtable(localst).derefimpl(false);
end;
inlininginfo^.code.derefimpl;
{ funcretsym, this is always located in the localst }
funcretsym:=tsym(funcretsymderef.resolve);

10
tests/webtbs/tw23071.pp Normal file
View File

@ -0,0 +1,10 @@
{ %NORUN }
{ %RECOMPILE }
{$MODE DELPHI}
uses uw23071;
begin
TWrapper<Byte>.Z;
end.

20
tests/webtbs/uw23071.pp Normal file
View File

@ -0,0 +1,20 @@
unit uw23071;
{$MODE DELPHI}
interface
type
TWrapper<T> = record
class procedure Z; static;
end;
implementation
class procedure TWrapper<T>.Z;
type
TLocalInteger = Integer;
begin
end;
end.