1-- C74211B.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-- CHECK THAT IMPLICITLY DECLARED INEQUALITY WHICH ACCOMPANIES AN
26-- EXPLICIT DECLARATION OF EQUALITY HIDES OTHER IMPLICITLY DECLARED
27-- HOMOGRAPHS, AND THAT DERIVED INEQUALITY HIDES PREDEFINED INEQUALITY.
28
29-- DSJ 4/29/83
30-- JBG 9/23/83
31
32WITH REPORT;
33PROCEDURE C74211B IS
34
35     USE REPORT;
36
37BEGIN
38
39     TEST( "C74211B", "CHECK THAT HIDING OF IMPLICITLY DECLARED " &
40                      "OPERATORS AND DERIVED SUBPROGRAMS IS DONE " &
41                      "CORRECTLY REGARDLESS OF ORDER OF DECL'S");
42
43     DECLARE
44
45          PACKAGE P1 IS
46               TYPE LT1 IS LIMITED PRIVATE;
47               FUNCTION "="(L, R : LT1) RETURN BOOLEAN;
48               FUNCTION LT1_VALUE_2 RETURN LT1;
49               FUNCTION LT1_VALUE_4 RETURN LT1;
50               TYPE LT2 IS LIMITED PRIVATE;
51          PRIVATE
52               TYPE LT1 IS RANGE 1 .. 10;
53               TYPE LT2 IS RANGE 1 .. 10;
54          END P1;
55
56          USE P1;
57
58          PACKAGE P2 IS
59               TYPE LT3 IS LIMITED PRIVATE;
60               TYPE LT4 IS NEW LT1;
61          PRIVATE
62               FUNCTION "=" (L, R : LT3) RETURN BOOLEAN;
63               TYPE LT3 IS NEW LT1;
64          END P2;
65
66          USE P2;
67
68          PACKAGE BODY P1 IS
69               A , B : CONSTANT LT1 := 4;
70               C , D : CONSTANT LT2 := 6;
71
72               FUNCTION "=" (L, R : LT1) RETURN BOOLEAN IS
73               BEGIN
74                    RETURN INTEGER(L) /= INTEGER(R);
75               END "=";
76
77               FUNCTION LT1_VALUE_2 RETURN LT1 IS
78               BEGIN
79                    RETURN 2;
80               END LT1_VALUE_2;
81
82               FUNCTION LT1_VALUE_4 RETURN LT1 IS
83               BEGIN
84                    RETURN 4;
85               END LT1_VALUE_4;
86
87          BEGIN
88               IF A = B THEN
89                    FAILED ("PREDEFINED EQUALITY NOT HIDDEN BY " &
90                            "EXPLICIT DECLARATION - LT1");
91               END IF;
92
93               IF C /= D  THEN
94                    FAILED ("WRONG PREDEFINED OPERATION - T2");
95               END IF;
96          END P1;
97
98          PACKAGE BODY P2 IS
99               FUNCTION U RETURN LT3 IS
100               BEGIN
101                    RETURN LT1_VALUE_2;
102               END U;
103
104               FUNCTION V RETURN LT3 IS
105               BEGIN
106                    RETURN LT1_VALUE_4;
107               END V;
108
109               FUNCTION W RETURN LT4 IS
110               BEGIN
111                    RETURN LT1_VALUE_2;
112               END W;
113
114               FUNCTION X RETURN LT4 IS
115               BEGIN
116                    RETURN LT1_VALUE_4;
117               END X;
118
119               FUNCTION "=" (L, R : LT3) RETURN BOOLEAN IS
120               BEGIN
121                    RETURN NOT (LT1(L) = LT1(R));
122               END "=";
123
124          BEGIN
125               IF NOT (U /= V) THEN
126                    FAILED ("DERIVED SUBPROGRAM NOT HIDDEN BY " &
127                            "IMPLICITLY DECLARED INEQUALITY " &
128                            "FROM EXPLICITLY DECLARED EQUALITY");
129               END IF;
130
131               IF NOT (LT3(W) = U) THEN
132                    FAILED ("DERIVED SUBPROGRAM NOT HIDDEN BY " &
133                            "EXPLICIT DECLARATION - '=' ");
134               END IF;
135
136               IF W /= X THEN
137                    FAILED ("PREDEFINED OPERATOR NOT HIDDEN BY " &
138                            "DERIVED SUBPROGRAM - '/=' ");
139               END IF;
140
141               IF NOT ( X = W ) THEN
142                    FAILED ("PREDEFINED OPERATOR NOT HIDDEN BY " &
143                            "DERIVED SUBPROGRAM - '=' ");
144               END IF;
145
146          END P2;
147
148     BEGIN
149
150          NULL;
151
152     END;
153
154     RESULT;
155
156END C74211B;
157