Browse Source

* fixed previous messy commit: indexed interface properties are allowed in delphi mode (still not in objfpc mode)

florian 3 days ago
parent
commit
e8d90a3042
3 changed files with 18 additions and 2 deletions
  1. 1 1
      compiler/pdecvar.pas
  2. 16 0
      tests/webtbf/tw3583.pp
  3. 1 1
      tests/webtbs/tw3583.pp

+ 1 - 1
compiler/pdecvar.pas

@@ -393,7 +393,7 @@ implementation
            begin
               { Published indexed properties are allowed in Delphi in interfaces compiled with $M+. }
               if (p.visibility=vis_published) and
-                not(is_interfacecom_or_dispinterface(astruct)) then
+                not((m_delphi in current_settings.modeswitches) and is_interfacecom_or_dispinterface(astruct)) then
                 Message(parser_e_cant_publish_that_property);
               { create a list of the parameters }
               p.parast:=tparasymtable.create(nil,0);

+ 16 - 0
tests/webtbf/tw3583.pp

@@ -0,0 +1,16 @@
+{ %fail }
+{$mode objfpc}
+type
+  IGUserData = interface(IInvokable)
+    ['{35377B66-6B1B-11D9-8827-00055DDDEA00}']
+    (* userdata *)
+    function GetUserData(key: UTF8String): IInterface;
+    procedure SetUserData(key: UTF8String; const v: IInterface);
+
+    function GetUserDataVariant(key: UTF8String): Variant;
+    procedure SetUserDataVariant(key: UTF8String; const v: Variant);
+
+    property UserData[key: UTF8String]: IInterface read GetUserData write SetUserData;
+  end;
+begin
+end.

+ 1 - 1
tests/webtbs/tw3583.pp

@@ -1,4 +1,4 @@
-{$mode objfpc}
+{$mode delphi}
 type
   IGUserData = interface(IInvokable)
     ['{35377B66-6B1B-11D9-8827-00055DDDEA00}']