Jelajahi Sumber

* generate specializations only of no error happened so far to prevent further (internal)errors, resolves #40646

florian 1 tahun lalu
induk
melakukan
af482fde23
2 mengubah file dengan 19 tambahan dan 2 penghapusan
  1. 3 2
      compiler/pmodules.pas
  2. 16 0
      tests/webtbf/tw40646.pp

+ 3 - 2
compiler/pmodules.pas

@@ -2313,9 +2313,10 @@ type
            end;
 
          { Generate specializations of objectdefs methods }
-         generate_specialization_procs;
+         if Errorcount=0 then
+           generate_specialization_procs;
 
-         // This needs to be done before we generate the VMTs
+         { This needs to be done before we generate the VMTs }
          if (target_cpu=tsystemcpu.cpu_wasm32) then
            add_synthetic_interface_classes_for_st(current_module.localsymtable);
 

+ 16 - 0
tests/webtbf/tw40646.pp

@@ -0,0 +1,16 @@
+{ %fail }
+program Project1;
+type
+  generic TFoo<_A: TObject> = class
+    type x = type _A;
+    type b = class(x)
+    end;
+  end;
+
+  TBar = class sealed
+  end;
+
+  TAbc = specialize TFoo<TBar>;
+
+begin
+end.