3 -- Grant of Unlimited Rights
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
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.
25 -- CHECK DISCRIMINANT CONSTRAINTS FOR ASSIGNMENT OF ACCESS SUBTYPES.
26 -- SPECIFICALLY, CHECK THAT:
28 -- A) ANY ACCESS TYPE VARIABLE AND CONSTRAINED SUBTYPE VARIABLES OF THAT
29 -- TYPE MAY BE ASSIGNED TO ONE ANOTHER IF THE VALUE BEING ASSIGNED
32 -- B) VARIABLES OF THE SAME CONSTRAINED ACCESS SUBTYPE MAY BE ASSIGNED
33 -- TO ONE ANOTHER OR TO VARIABLES OF THE BASE ACCESS TYPE.
35 -- C) CONSTRAINT_ERROR IS RAISED UPON ASSIGNMENT OF NON-NULL OBJECTS
36 -- BETWEEN DIFFERENTLY CONSTRAINED ACCESS SUBTYPES.
38 -- D) CONSTRAINT_ERROR IS RAISED UPON ASSIGNMENT OF A NON-NULL OBJECT
39 -- OF A BASE ACCESS TYPE VARIABLE TO A VARIABLE OF ONE OF ITS
40 -- CONSTRAINED SUBTYPES IF THE CONSTRAINTS ON THE OBJECT DIFFER
41 -- FROM THOSE ON THE SUBTYPE.
43 -- E) NULL CAN BE ASSIGNED TO BASE ACCESS TYPES AND ANY CONSTRAINED
44 -- SUBTYPES OF THIS TYPE.
48 -- RLB 6/29/01 - FIXED TO ALLOW AGGRESIVE OPTIMIZATION.
55 TYPE REC
(DISC
: INTEGER := -1 ) IS
60 TYPE REC_NAME
IS ACCESS REC
;
61 SUBTYPE S1
IS REC_NAME
(IDENT_INT
(5));
62 SUBTYPE S2
IS REC_NAME
(IDENT_INT
(3));
64 W
: REC_NAME
:= NULL; -- E.
65 X1
,X2
: S1
:= NULL; -- E.
66 Y1
,Y2
: S2
:= NULL; -- E.
68 W_NONNULL
: REC_NAME
:= NEW REC
(7) ;
69 X1_NONNULL
: S1
:= NEW REC
(IDENT_INT
(5));
70 Y1_NONNULL
: S2
:= NEW REC
(IDENT_INT
(3));
72 TOO_EARLY
: BOOLEAN := TRUE;
76 TEST
("C52011B", "DISCRIMINANT CONSTRAINTS ON ACCESS SUBTYPE " &
77 "OBJECTS MUST BE SATISFIED FOR ASSIGNMENT");
82 W_NONNULL
:= X1
; -- A.
84 IF W_NONNULL
/= X1
THEN
85 FAILED
("ASSIGNMENT FAILED - 1");
92 FAILED
("ASSIGNMENT FAILED - 2");
96 X1_NONNULL
:= Y1
; -- A.
98 IF X1_NONNULL
/= Y1
THEN
99 FAILED
("ASSIGNMENT FAILED - 3");
103 Y1_NONNULL
:= Y2
; -- A.
105 IF Y1_NONNULL
/= Y2
THEN
106 FAILED
("ASSIGNMENT FAILED - 4");
109 X1
:= NEW REC
(IDENT_INT
(5));
114 FAILED
("ASSIGNMENT FAILED - 5");
121 FAILED
("ASSIGNMENT FAILED - 6");
126 IF Y1
.DISC
/= REPORT
.IDENT_INT
(3) THEN
127 FAILED
("NON-NULL ASSIGNMENT MADE BETWEEN TWO " &
128 "VARIABLES OF DIFFERENT CONSTRAINED ACCESS SUBTYPES " &
129 "AND CONSTRAINT IS CHANGED");
131 FAILED
("NON-NULL ASSIGNMENT MADE BETWEEN TWO " &
132 "VARIABLES OF DIFFERENT CONSTRAINED ACCESS SUBTYPES " &
133 "AND CONSTRAINT IS NOT CHANGED");
137 WHEN CONSTRAINT_ERROR
=> NULL;
140 FAILED
("WRONG EXCEPTION - 1");
144 W
:= NEW REC
(IDENT_INT
(3));
148 IF X1
.DISC
/= REPORT
.IDENT_INT
(5) THEN
149 FAILED
("NON-NULL ASSIGNMENT MADE FROM UNCONSTRAINED " &
150 "ACCESS TYPE DESIGNATING CONSTRAINED OBJECT TO "&
151 "ACCESS SUBTYPE WITH DIFFERENT CONSTRAINT " &
152 "AND CONSTRAINT IS CHANGED");
154 FAILED
("NON-NULL ASSIGNMENT MADE FROM UNCONSTRAINED " &
155 "ACCESS TYPE DESIGNATING CONSTRAINED OBJECT TO "&
156 "ACCESS SUBTYPE WITH DIFFERENT CONSTRAINT " &
157 "AND CONSTRAINT IS NOT CHANGED");
161 WHEN CONSTRAINT_ERROR
=>
165 FAILED
("WRONG EXCEPTION - 2");
172 FAILED
("EXCEPTION RAISED");