Przeglądaj źródła

* allow types in interfaces

git-svn-id: trunk@8840 -
peter 18 lat temu
rodzic
commit
a6eb5d839b
3 zmienionych plików z 32 dodań i 7 usunięć
  1. 1 0
      .gitattributes
  2. 9 7
      compiler/pdecobj.pas
  3. 22 0
      tests/webtbs/tw9509.pp

+ 1 - 0
.gitattributes

@@ -8481,6 +8481,7 @@ tests/webtbs/tw9384.pp svneol=native#text/plain
 tests/webtbs/tw9385.pp svneol=native#text/plain
 tests/webtbs/tw9419.pp svneol=native#text/plain
 tests/webtbs/tw9461.pp svneol=native#text/plain
+tests/webtbs/tw9509.pp svneol=native#text/plain
 tests/webtbs/tw9667.pp svneol=native#text/plain
 tests/webtbs/tw9672.pp svneol=native#text/plain
 tests/webtbs/tw9673.pp -text

+ 9 - 7
compiler/pdecobj.pas

@@ -663,15 +663,17 @@ implementation
                           end;
                         else
                           begin
-                            if is_interface(aktobjectdef) then
-                              Message(parser_e_no_vars_in_interfaces);
+                            if current_blocktype=bt_general then
+                              begin
+                                if is_interface(aktobjectdef) then
+                                  Message(parser_e_no_vars_in_interfaces);
 
-                            if (sp_published in current_object_option) and
-                              not(oo_can_have_published in aktobjectdef.objectoptions) then
-                              Message(parser_e_cant_have_published);
+                                if (sp_published in current_object_option) and
+                                  not(oo_can_have_published in aktobjectdef.objectoptions) then
+                                  Message(parser_e_cant_have_published);
 
-                            if current_blocktype=bt_general then
-                              read_record_fields([vd_object])
+                                read_record_fields([vd_object])
+                              end
                             else
                               types_dec;
                           end;

+ 22 - 0
tests/webtbs/tw9509.pp

@@ -0,0 +1,22 @@
+{$mode objfpc}
+{$interfaces corba}
+type
+  generic IList<TElem> = interface
+  end;
+
+  generic ISet<TElem> = interface
+  end;
+
+  generic IMap<TKey, TValue> = interface
+
+    type
+      TKeySet = specialize ISet<TKey>; // wrong syntax?
+      TValueSet = specialize IList<TValue>; // wrong syntax?
+
+    function Keys : TKeySet;
+    function Values : TValueSet;
+  end;
+
+begin
+end.
+