Bladeren bron

* Virtual methods cannot be declared as static (static virtual method has no sense).

+ added tests

git-svn-id: trunk@35724 -
maciej-izak 8 jaren geleden
bovenliggende
commit
8391b73206
5 gewijzigde bestanden met toevoegingen van 51 en 2 verwijderingen
  1. 3 0
      .gitattributes
  2. 2 2
      compiler/pdecsub.pas
  3. 15 0
      tests/tbf/tb0255a.pp
  4. 15 0
      tests/tbf/tb0255b.pp
  5. 16 0
      tests/tbf/tb0255c.pp

+ 3 - 0
.gitattributes

@@ -10477,6 +10477,9 @@ tests/tbf/tb0252c.pp svneol=native#text/plain
 tests/tbf/tb0253.pp svneol=native#text/pascal
 tests/tbf/tb0254a.pp svneol=native#text/pascal
 tests/tbf/tb0254b.pp svneol=native#text/pascal
+tests/tbf/tb0255a.pp svneol=native#text/pascal
+tests/tbf/tb0255b.pp svneol=native#text/pascal
+tests/tbf/tb0255c.pp svneol=native#text/pascal
 tests/tbf/ub0115.pp svneol=native#text/plain
 tests/tbf/ub0149.pp svneol=native#text/plain
 tests/tbf/ub0158a.pp svneol=native#text/plain

+ 2 - 2
compiler/pdecsub.pas

@@ -2680,7 +2680,7 @@ const
       pooption : [po_staticmethod];
       mutexclpocall : [pocall_internproc];
       mutexclpotype : [potype_constructor,potype_destructor,potype_class_constructor,potype_class_destructor];
-      mutexclpo     : [po_interrupt,po_exports]
+      mutexclpo     : [po_interrupt,po_exports,po_virtualmethod]
     ),(
       idtok:_STDCALL;
       pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar];
@@ -2710,7 +2710,7 @@ const
       pooption : [po_virtualmethod];
       mutexclpocall : [pocall_internproc];
       mutexclpotype : [potype_class_constructor,potype_class_destructor];
-      mutexclpo     : [po_interrupt,po_exports,po_overridingmethod,po_inline]
+      mutexclpo     : [po_interrupt,po_exports,po_overridingmethod,po_inline,po_staticmethod]
     ),(
       idtok:_CPPDECL;
       pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar];

+ 15 - 0
tests/tbf/tb0255a.pp

@@ -0,0 +1,15 @@
+{ %FAIL }
+
+{$MODE DELPHI}
+
+type
+  TFoo = class
+    class procedure F; virtual; static;
+  end;
+
+class procedure TFoo.F;
+begin
+end;
+
+begin
+end.

+ 15 - 0
tests/tbf/tb0255b.pp

@@ -0,0 +1,15 @@
+{ %FAIL }
+
+{$MODE DELPHI}
+
+type
+  TFoo = class
+    class procedure F; static; virtual;
+  end;
+
+class procedure TFoo.F;
+begin
+end;
+
+begin
+end.

+ 16 - 0
tests/tbf/tb0255c.pp

@@ -0,0 +1,16 @@
+{ %FAIL }
+
+{$MODE DELPHI}
+
+type
+  TFoo = class
+    class procedure F(V: byte); virtual;
+    class property P: byte write F;
+  end;
+
+class procedure TFoo.F(V: byte);
+begin
+end;
+
+begin
+end.