1-- C83027A.ADA
2
3--                             Grant of Unlimited Rights
4--
5--     Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6--     F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7--     unlimited rights in the software and documentation contained herein.
8--     Unlimited rights are defined in DFAR 252.227-7013(a)(19).  By making
9--     this public release, the Government intends to confer upon all
10--     recipients unlimited rights  equal to those held by the Government.
11--     These rights include rights to use, duplicate, release or disclose the
12--     released technical data and computer software in whole or in part, in
13--     any manner and for any purpose whatsoever, and to have or permit others
14--     to do so.
15--
16--                                    DISCLAIMER
17--
18--     ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19--     DISCLOSED ARE AS IS.  THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20--     WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21--     SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22--     OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23--     PARTICULAR PURPOSE OF SAID MATERIAL.
24--*
25-- OBJECTIVE:
26--     CHECK THAT A DECLARATION IN A RECORD DECLARATION HIDES AN OUTER
27--     DECLARATION OF A HOMOGRAPH. ALSO CHECK THAT THE OUTER DECLARATION
28--     IS DIRECTLY VISIBLE IN BOTH DECLARATIVE REGIONS BEFORE THE
29--     DECLARATION OF THE INNER HOMOGRAPH AND THE OUTER DECLARATION IS
30--     VISIBLE BY SELECTION AFTER THE INNER HOMOGRAPH DECLARATION.
31
32-- HISTORY:
33--     BCB 09/02/88  CREATED ORIGINAL TEST.
34
35WITH REPORT; USE REPORT;
36PROCEDURE C83027A IS
37
38     GENERIC
39          TYPE T IS PRIVATE;
40          X : T;
41     FUNCTION GEN_FUN RETURN T;
42
43     FUNCTION GEN_FUN RETURN T IS
44     BEGIN
45          RETURN X;
46     END GEN_FUN;
47
48BEGIN
49     TEST ("C83027A", "CHECK THAT A DECLARATION IN A RECORD " &
50                      "DECLARATION HIDES AN OUTER DECLARATION OF " &
51                      "A HOMOGRAPH");
52
53     ONE:
54     DECLARE
55          A : INTEGER := IDENT_INT(2);
56          OBJ : INTEGER := IDENT_INT(3);
57
58          TYPE INNER2 (A : INTEGER := IDENT_INT(3)) IS RECORD
59               C : INTEGER := ONE.A;
60               D : INTEGER := A;
61          END RECORD;
62
63          E : INTEGER := A;
64
65          RECVAR : INNER2;
66
67     BEGIN  -- ONE
68          IF A /= IDENT_INT(2) THEN
69               FAILED ("INCORRECT VALUE FOR OUTER HOMOGRAPH - 1");
70          END IF;
71
72          IF RECVAR.A /= IDENT_INT(3) THEN
73               FAILED ("INCORRECT VALUE FOR INNER HOMOGRAPH - 2");
74          END IF;
75
76          IF E /= IDENT_INT(2) THEN
77               FAILED ("INCORRECT VALUE FOR OUTER VARIABLE - 3");
78          END IF;
79
80          IF RECVAR.C /= IDENT_INT(2) THEN
81               FAILED ("INCORRECT VALUE FOR INNER VARIABLE - 4");
82          END IF;
83
84          IF RECVAR.D /= IDENT_INT(3) THEN
85               FAILED ("INCORRECT VALUE FOR INNER VARIABLE - 5");
86          END IF;
87
88          IF EQUAL(1,1) THEN
89               OBJ := RECVAR.A;
90          ELSE
91               OBJ := 1;
92          END IF;
93
94          IF OBJ /= IDENT_INT(3) THEN
95               FAILED ("INCORRECT VALUE PASSED OUT - 6");
96          END IF;
97     END ONE;
98
99     TWO:
100     DECLARE
101
102          GENERIC
103               A : INTEGER := IDENT_INT(2);
104               B : INTEGER := A;
105          PACKAGE P IS
106               TYPE INNER (C : INTEGER := A;
107                           A : INTEGER := IDENT_INT(3)) IS RECORD
108                    D : INTEGER := A;
109               END RECORD;
110          END P;
111
112          PACKAGE BODY P IS
113               RECVAR : INNER;
114          BEGIN
115               IF RECVAR.A /= IDENT_INT(3) THEN
116                    FAILED ("INCORRECT VALUE FOR INNER HOMOGRAPH - 10");
117               END IF;
118
119               IF A /= IDENT_INT(2) THEN
120                    FAILED ("INCORRECT VALUE FOR OUTER HOMOGRAPH - 11");
121               END IF;
122
123               IF B /= IDENT_INT(2) THEN
124                    FAILED ("INCORRECT VALUE FOR OUTER VARIABLE - 12");
125               END IF;
126
127               IF RECVAR.C /= IDENT_INT(2) THEN
128                    FAILED ("INCORRECT VALUE FOR INNER VARIABLE - 13");
129               END IF;
130
131               IF RECVAR.D /= IDENT_INT(3) THEN
132                    FAILED ("INCORRECT VALUE FOR INNER VARIABLE - 14");
133               END IF;
134          END P;
135
136          PACKAGE PACK IS NEW P;
137
138     BEGIN  -- TWO
139          NULL;
140     END TWO;
141
142     THREE:
143     DECLARE
144          A : INTEGER := IDENT_INT(2);
145          OBJ : INTEGER := IDENT_INT(3);
146
147          TYPE INNER4 (C : INTEGER := A;
148                       A : INTEGER := IDENT_INT(3);
149                       X : INTEGER := THREE.A) IS RECORD
150               D : INTEGER := A;
151          END RECORD;
152
153          RECVAR : INNER4;
154
155     BEGIN  -- THREE
156          IF A /= IDENT_INT(2) THEN
157               FAILED ("INCORRECT VALUE FOR OUTER HOMOGRAPH - 20");
158          END IF;
159
160          IF RECVAR.A /= IDENT_INT(3) THEN
161               FAILED ("INCORRECT VALUE FOR INNER HOMOGRAPH - 21");
162          END IF;
163
164          IF RECVAR.C /= IDENT_INT(2) THEN
165               FAILED ("INCORRECT VALUE FOR INNER VARIABLE - 22");
166          END IF;
167
168          IF RECVAR.D /= IDENT_INT(3) THEN
169               FAILED ("INCORRECT VALUE FOR INNER VARIABLE - 23");
170          END IF;
171
172          IF RECVAR.X /= IDENT_INT(2) THEN
173               FAILED ("INCORRECT VALUE FOR INNER VARIABLE - 24");
174          END IF;
175
176          IF EQUAL(1,1) THEN
177               OBJ := RECVAR.A;
178          ELSE
179               OBJ := 1;
180          END IF;
181
182          IF OBJ /= IDENT_INT(3) THEN
183               FAILED ("INCORRECT VALUE PASSED OUT - 25");
184          END IF;
185     END THREE;
186
187     RESULT;
188END C83027A;
189