Răsfoiți Sursa

* fix #41506: check against the correct symtable type (namely static instead of record)
+ added tests

Sven/Sarah Barth 2 săptămâni în urmă
părinte
comite
76099bf30e
4 a modificat fișierele cu 45 adăugiri și 1 ștergeri
  1. 1 1
      compiler/pgenutil.pas
  2. 13 0
      tests/webtbs/tw41506a.pp
  3. 20 0
      tests/webtbs/tw41506b.pp
  4. 11 0
      tests/webtbs/uw41506.pp

+ 1 - 1
compiler/pgenutil.pas

@@ -1528,7 +1528,7 @@ uses
           begin
             if not assigned(symowner) then
               internalerror(2022102101);
-            if not (symowner.symtabletype in [globalsymtable,recordsymtable]) then
+            if not (symowner.symtabletype in [globalsymtable,staticsymtable]) then
               internalerror(2022102102);
             hmodule:=find_module_from_symtable(symowner);
             if not assigned(hmodule) then

+ 13 - 0
tests/webtbs/tw41506a.pp

@@ -0,0 +1,13 @@
+{ %NORUN }
+
+program tw41506a;
+{$mode objFPC}
+
+type
+  generic TGenClass<T> = class
+  end;
+  TCommon = tw41506a.specialize TGenClass<byte>;
+
+begin
+end.
+

+ 20 - 0
tests/webtbs/tw41506b.pp

@@ -0,0 +1,20 @@
+{ %NORUN }
+
+program tw41506b;
+{$mode ObjFPC}{$H+}
+
+uses uw41506;
+
+type
+  generic TGenClassCommon<T> = class F:T; end;
+
+  TCommon1 = specialize TGenClassCommon{declaration:TGenClassCommon}
+  <byte>;
+  TCommon2 = tw41506b.specialize TGenClassCommon{declaration:TGenClassCommon}
+  <byte>;
+  TCommon3 = uw41506.specialize TGenClassCommon{declaration:u_specialize_inline.TGenClassCommon}
+  <byte>;
+
+begin
+
+end.

+ 11 - 0
tests/webtbs/uw41506.pp

@@ -0,0 +1,11 @@
+unit uw41506;
+{$mode ObjFPC}{$H+}
+interface
+
+type
+
+  generic TGenClassCommon<T> = class F:T; end;
+implementation
+
+end.
+