Fix for Mantis #30030.

pgenutil.pas:
  * parse_generic_specialization_types_internal: ignore the parasymtable of procvars (as before the addition of generic routines) and instead use the type's hierarchy name
  * generate_specialization_phase2: specialize types of procvars into the parameter symtable as they don't have a local one

+ added test

git-svn-id: trunk@33544 -
This commit is contained in:
svenbarth 2016-04-22 13:07:48 +00:00
parent bae53fda21
commit d07b49270f
3 changed files with 19 additions and 3 deletions

1
.gitattributes vendored
View File

@ -15013,6 +15013,7 @@ tests/webtbs/tw29958.pp svneol=native#text/pascal
tests/webtbs/tw2998.pp svneol=native#text/plain
tests/webtbs/tw2999.pp svneol=native#text/plain
tests/webtbs/tw29992.pp svneol=native#text/plain
tests/webtbs/tw30030.pp svneol=native#text/pascal
tests/webtbs/tw30035.pp svneol=native#text/plain
tests/webtbs/tw30035a.pp svneol=native#text/plain
tests/webtbs/tw3004.pp svneol=native#text/plain

View File

@ -349,11 +349,10 @@ uses
begin
{ we use the full name of the type to uniquely identify it }
if (symtablestack.top.symtabletype=parasymtable) and
(symtablestack.top.defowner.typ=procdef) and
(typeparam.resultdef.owner=symtablestack.top) then
begin
{ special handling for specializations inside generic function declarations }
if symtablestack.top.defowner.typ<>procdef then
internalerror(2015080101);
namepart:=tdef(symtablestack.top.defowner).unique_id_str;
namepart:='genproc'+namepart+'_'+tdef(symtablestack.top.defowner).fullownerhierarchyname+'_'+tprocdef(symtablestack.top.defowner).procsym.realname+'_'+typeparam.resultdef.typename;
prettynamepart:=tdef(symtablestack.top.defowner).fullownerhierarchyname+tprocdef(symtablestack.top.defowner).procsym.prettyname;
@ -795,7 +794,8 @@ uses
{ we specialize the partial specialization into the symtable of the currently parsed
generic }
case current_genericdef.typ of
procvardef,
procvardef:
specializest:=current_genericdef.getsymtable(gs_para);
procdef:
specializest:=current_genericdef.getsymtable(gs_local);
objectdef,

15
tests/webtbs/tw30030.pp Normal file
View File

@ -0,0 +1,15 @@
{ %NORUN }
program tw30030;
{$mode delphi}
type
TAcl<K, R, M> = Class
End;
TAssertion<K, R, M> = Function(Acl: TAcl<K, R, M>): Boolean Of Object;
begin
end.