* fix for Mantis #22192: handle the case that a specialization has the same name as the generic it's based on as in that case the typedef of the symbol is an errordef; therefor we need to use the symbol's real name

+ added test

git-svn-id: trunk@34530 -
This commit is contained in:
svenbarth 2016-09-16 15:13:27 +00:00
parent fd7daf91df
commit 50f2aab0ef
3 changed files with 17 additions and 1 deletions

1
.gitattributes vendored
View File

@ -14740,6 +14740,7 @@ tests/webtbs/tw22154.pp svneol=native#text/pascal
tests/webtbs/tw22155.pp svneol=native#text/plain
tests/webtbs/tw22160a1.pp svneol=native#text/pascal
tests/webtbs/tw22160b1.pp svneol=native#text/pascal
tests/webtbs/tw22192.pp svneol=native#text/pascal
tests/webtbs/tw2220.pp svneol=native#text/plain
tests/webtbs/tw22225.pp svneol=native#text/pascal
tests/webtbs/tw2226.pp svneol=native#text/plain

View File

@ -1409,6 +1409,7 @@ implementation
function handle_specialize_inline_specialization(var srsym:tsym;out srsymtable:tsymtable;out spezcontext:tspecializationcontext):boolean;
var
spezdef : tdef;
symname : tsymstr;
begin
result:=false;
spezcontext:=nil;
@ -1424,7 +1425,11 @@ implementation
spezdef:=ttypesym(srsym).typedef
else
spezdef:=tdef(tprocsym(srsym).procdeflist[0]);
spezdef:=generate_specialization_phase1(spezcontext,spezdef);
if (spezdef.typ=errordef) and (sp_generic_dummy in srsym.symoptions) then
symname:=srsym.RealName
else
symname:='';
spezdef:=generate_specialization_phase1(spezcontext,spezdef,symname);
case spezdef.typ of
errordef:
begin

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

@ -0,0 +1,10 @@
{ %NORUN }
{$MODE DELPHI}
type
TWrapper<T> = record end;
TWrapper = TWrapper<Byte>;
begin
end.