Browse Source

+ added test for recent generic related changes

Sven/Sarah Barth 1 month ago
parent
commit
60b8e0f56d
1 changed files with 33 additions and 0 deletions
  1. 33 0
      tests/test/tgeneric130.pp

+ 33 - 0
tests/test/tgeneric130.pp

@@ -0,0 +1,33 @@
+{ %NORUN }
+
+program tgeneric130;
+
+{$mode delphi}
+
+type
+  TNotifyEvent = procedure(aSender: TObject) of object;
+  TNotifyEvent<T> = procedure(aSender: TObject; aArg: T) of object;
+
+  IEvent<T> = interface
+    procedure Add(aArg: T);
+  end;
+
+  INotifyEvent = IEvent<TNotifyEvent>;
+
+  INotifyEvent<T> = interface(IEvent<TNotifyEvent<T>>)
+  ['{3B510AF8-DC7F-4C41-9118-2591E38D30D7}']
+  end;
+
+  TTest<T> = class(TInterfacedObject, INotifyEvent<T>)
+    procedure Add(aArg: TNotifyEvent<T>);
+  end;
+
+procedure TTest<T>.Add(aArg: TNotifyEvent<T>);
+begin
+end;
+
+var
+  intf: INotifyEvent<LongInt>;
+begin
+  intf := (TTest<LongInt>.Create) as INotifyEvent<LongInt>;
+end.