Sfoglia il codice sorgente

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 -
svenbarth 9 anni fa
parent
commit
d07b49270f
3 ha cambiato i file con 19 aggiunte e 3 eliminazioni
  1. 1 0
      .gitattributes
  2. 3 3
      compiler/pgenutil.pas
  3. 15 0
      tests/webtbs/tw30030.pp

+ 1 - 0
.gitattributes

@@ -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

+ 3 - 3
compiler/pgenutil.pas

@@ -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 - 0
tests/webtbs/tw30030.pp

@@ -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.