summaryrefslogtreecommitdiff
path: root/TAO/tests/IDL_Test/reopened_modules.idl
blob: 666e8116dcd5f448e317167ab874f555e982ec9d (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO/tests/IDL_Test
//
// = FILENAME
//    reopened_modules.idl
//
// = DESCRIPTION
//    This file contains examples of IDL code that has 
//    caused problems in the past for the TAO IDL
//    compiler. This test is to make sure the problems
//    stay fixed.
//
// = AUTHORS
//    Jeff Parsons <parsons@cs.wustl.edu> and TAO users.
//
// ============================================================================

// These examples test the lookup abilities of the
// TAO IDL compiler, with reopened modules.

// Tests lookup function when modules are reopened by
// a chain of inclusions.
#include "reopen_include2.idl"

module AA
{
  module BB
  {
    interface x1 {};
  };
};

module AA
{
  module BB
  {
    module CC
    {
      interface x2 
      {
        // 'A::B::' should be implicit
        void op1 (in x1 obj);
        // 'A::' should be implicit
        void op2 (in BB::x1 obj);
        // Just for reference
        void op3 (in AA::BB::x1 obj);
      };
    };
  };
};

// Each occurrence of Party and Person should be
// recognized as being in the same scope as the
// previous occurrence(s).

module dot 
{ 
  interface Party;

  interface Person 
    {
      attribute Party someParty;
    };
};

module dot 
{ 
  interface Party 
    {
      attribute Person somePerson;
    };
};

// Should be no problem in lookup of all the
// arguments in Operation.

module Outside
{
  module Reopened
    {
      typedef short Tricky;
    };

  typedef long Tricky;

  module Reopened
    {
      typedef float Newdef;
    };
};

interface OpHolder
  {

    void  Operation (in ::Outside::Tricky p1,
                     out ::Outside::Reopened::Tricky p2,
                     inout ::Outside::Reopened::Newdef p3);
  };

// This particular combination used to cause IDL compiler
// to go into an infinite loop looking for return type to
// getInfo(). Partial solution got rid of infinite loop, 
// but erroneously returned ::com from lookup.

module com 
{
  module mr 
    {
      typedef short info;
    };
};

module com 
{
  interface IFace
    {
      com::mr::info getInfo ();
    };
};

// Modules X and Y are also included from reopene_include2.idl.
// There were problems with the lookup of Y::Z and X::Ex.

module Y 
{
   interface Z {};
};

module X
{
   exception Ex {};

   interface BI : Y::Z 
   {
     void method () raises (X::Ex);
   };
};

// Reopened from reopen_include2.idl inclusion. There
// was a problem with the inheritance lookup.

module XX 
{
  interface blah_intfc;

  interface blah_intfc 
  {
    void op1 ();
  };

  interface blah0 : blah_intfc 
  {
    void op0 ();
  };
};

// Had lookup problems with the operation args and
// return type.

module frag
{
  interface frag_iface {};
};

module frag
{
  typedef long ret_long;
};

interface gather
{
  frag::ret_long op (in frag::dub_seq inarg,
                     inout frag::pug inoutarg,
                     out frag::frag_iface outarg);
};

// Had problems with second opening of module using
// types declared between the openings.

module foo
{
  typedef long longdef;
};

typedef long longdef2;

struct bar {short s;};

module foo
{
  struct foo_struct
  {
    longdef longval;
    longdef2 longval2;
  };

  interface obj
  {
    void op (in bar inarg);
  };
};

module A
{
  module B
  {
    typedef sequence<X2> X2Seq;

    interface X3 : X1, X2
    {
      X2Seq getSeqOfX2 ();
      string getX3 ();
    };
  };
};

// Interface B was not getting redefined, so
// definition of C would cause an error.

module mB
{
  interface B;
};

module mA
{
  interface A
  {
    attribute ::mB::B theB;
  };
};

module mB
{
  interface B : ::mA::A
  {
    attribute ::mA::A theA;
  };
};

module mC
{
  interface C : ::mB::B
  {
  };
};

// The example below uncovered errors in the logic of
// AST_Module::fe_add_interface_fwd() and 
// AST_Module::add_to_previous() that were causing
// AST_Module::look_in_previous() (and thus lookup_by_name)
// to fail on the last line.
module Schmoik
{
  interface foo
  {
    typedef string foo_type;
  };
};

module Schmoik
{
  interface foo;
};

module Schmoik
{
  struct bar
  {
    foo::foo_type member;
  };
};

// Tests forward declared interface as element type.
// Had to override visit_interface_fwd()
// for the be_visitor_sequence_base_template_args
// visitor to fix this. Also had to separate calls
// to nested_type_name() into individual insertions
// into the code generating stream, because of side
// effects.
module Thwoik
{
  interface TestType;
};  

module Thwoik
{
  typedef sequence<TestType> ub_TestTypeSeq;
  typedef sequence<TestType, 3> bd_TestTypeSeq;
};

module Thwoik
{
  interface TestType {};
};

// We had a problem with the inheritance list
// in the declaration of A_mod::B_mod::Foo, in 
// both stub and skeleton files.
module A_mod
{
  interface Foo {};

  module B_mod
  {
    interface Foo : A_mod::Foo {};
  };  
};