summaryrefslogtreecommitdiff
path: root/tests/webtbs/tw6690.pp
blob: 7ba05d0b92778165fc13e2c3e96620dc142271c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
program inheritedcorba;
{$mode objfpc}{$h+}
uses
 typinfo;

type
 {$interfaces corba}
 iinterface1 = interface
  procedure proc1;
 end;
 {$interfaces com}
 iinterface2 = interface
  procedure proc2;
 end;

 iinterface3 = interface(iinterface1)
  procedure proc3;
 end;
 iinterface4 = interface(iinterface2)
  procedure proc4;
 end;

 {$interfaces corba}
 iinterface5 = interface(iinterface1)
  procedure proc5;
 end;
 iinterface6 = interface(iinterface2)
  procedure proc6;
 end;

 tclass1 = class(iinterface1)
  public
   procedure proc1;
 end;

{tclass6 = class(iinterface6)
  public
   procedure proc6;
 end;
}
{ does not compile because it is com style interface:
 inheritedcorba.pas(36,12) Error: No matching implementation for
 interface method "IUnknown.QueryInterface(const TGuid,out <Formal type>):
  LongInt;StdCall" found  ...
}
procedure writeinterfacetype(po: ptypeinfo);
begin
 case po^.kind of
  tkinterfaceraw: if (po^.name<>'iinterface1') and
                  (po^.name<>'iinterface3') and
                  (po^.name<>'iinterface5') then
                  halt(1);
  tkinterface: if (po^.name<>'iinterface2') and
                  (po^.name<>'iinterface4') and
                  (po^.name<>'iinterface6') then
                  halt(2);
  else
    halt(3);
 end;
end;

{ tclass1 }

procedure tclass1.proc1;
begin
end;

begin
 writeinterfacetype(typeinfo(iinterface1));
 writeinterfacetype(typeinfo(iinterface2));
 writeinterfacetype(typeinfo(iinterface3));
 writeinterfacetype(typeinfo(iinterface4));
 writeinterfacetype(typeinfo(iinterface5));
 writeinterfacetype(typeinfo(iinterface6));
 writeln('ok');
end.