1-- C67005D.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 EQUALITY CAN BE REDEFINED FOR AN ARBITRARY TYPE BY USING A
26-- SEQUENCE OF RENAMING DECLARATIONS.
27
28-- JBG 9/11/84
29
30WITH REPORT; USE REPORT;
31PROCEDURE C67005D IS
32
33     FUNCTION MY_EQUALS  (L, R : INTEGER) RETURN BOOLEAN IS
34     BEGIN
35          RETURN FALSE;
36     END MY_EQUALS;
37
38     GENERIC
39          TYPE LP IS LIMITED PRIVATE;
40          WITH FUNCTION "=" (L, R : LP) RETURN BOOLEAN;
41     PACKAGE EQUALITY_OPERATOR IS
42          PACKAGE INNER IS
43               FUNCTION "=" (L, R : LP) RETURN BOOLEAN RENAMES
44                             EQUALITY_OPERATOR."=";
45          END INNER;
46     END EQUALITY_OPERATOR;
47
48BEGIN
49     TEST ("C67005D", "CHECK REDEFINITION OF ""="" BY RENAMING");
50
51     DECLARE
52
53          CHK1 : BOOLEAN := 3 = IDENT_INT(3);     -- PREDEFINED "="
54
55          -- REDEFINE INTEGER "=".
56
57          PACKAGE INT_EQUALITY IS NEW
58               EQUALITY_OPERATOR (INTEGER, MY_EQUALS);
59          FUNCTION "=" (L, R : INTEGER) RETURN BOOLEAN RENAMES
60               INT_EQUALITY.INNER."=";
61
62          CHK2 : BOOLEAN := 3 = IDENT_INT(3);     -- REDEFINED "=".
63
64     BEGIN
65
66          IF NOT CHK1 THEN
67               FAILED ("PREDEFINED ""="" NOT USED");
68          END IF;
69
70          IF CHK2 THEN
71               FAILED ("REDEFINED ""="" NOT USED");
72          END IF;
73
74     END;
75
76     RESULT;
77
78END C67005D;
79