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.
26 -- A DISCRIMINANT CONSTRAINT
27 -- DEPENDS ON A DISCRIMINANT, THE NON-DISCRIMINANT EXPRESSIONS IN THE
28 -- CONSTRAINT ARE EVALUATED WHEN THE COMPONENT SUBTYPE DEFINITION IS
29 -- ELABORATED, BUT THE VALUES ARE CHECKED WHEN THE RECORD TYPE IS:
31 -- CASE B: USED WITHOUT A CONSTRAINT ONLY IN AN ALLOCATOR OR OBJECT
36 WITH REPORT
; USE REPORT
;
39 SUBTYPE SM
IS INTEGER RANGE 1..10;
41 TYPE REC
(D1
, D2
: SM
) IS
42 RECORD NULL; END RECORD;
44 F1_CONS
: INTEGER := 2;
49 MESSAGE
: STRING) RETURN BOOLEAN IS
52 FAILED
(MESSAGE
& ": CONS IS " &
58 FUNCTION F1
RETURN INTEGER IS
60 F1_CONS
:= F1_CONS
- IDENT_INT
(1);
65 TEST
("C37213B", "CHECK EVALUATION OF DISCRIMINANT EXPRESSIONS " &
66 "WHEN CONSTRAINT DEPENDS ON DISCRIMINANT, " &
67 "AND DISCRIMINANTS HAVE DEFAULTS");
72 TYPE CONS
(D3
: INTEGER := 1) IS
74 C1
: REC
(D3
, F1
); -- F1 EVALUATED
76 CHK1
: BOOLEAN := CHK
(F1_CONS
, 1, "F1 NOT EVALUATED");
77 X
: CONS
; -- F1 NOT EVALUATED AGAIN
78 Y
: CONS
; -- F1 NOT EVALUATED AGAIN
79 CHK2
: BOOLEAN := CHK
(F1_CONS
, 1, "F1 EVALUATED");
81 IF X
/= (1, (1, 1)) OR Y
/= (1, (1, 1)) THEN
82 FAILED
("DISCRIMINANT VALUES NOT CORRECT");
89 TYPE CONS
(D3
: INTEGER := 1) IS
98 FAILED
("DISCRIMINANT CHECK NOT PERFORMED - 1");
99 IF X
/= (1, (1, 1)) THEN
100 COMMENT
("SHOULDN'T GET HERE");
104 WHEN CONSTRAINT_ERROR
=>
107 FAILED
("UNEXPECTED EXCEPTION - 1");
112 TYPE ACC_CONS
IS ACCESS CONS
;
116 FAILED
("DISCRIMINANT CHECK NOT PERFORMED - 2");
118 IF X
.ALL /= (1, (1, 1)) THEN
119 COMMENT
("IRRELEVANT");
123 WHEN CONSTRAINT_ERROR
=>
126 FAILED
("UNEXPECTED EXCEPTION RAISED - 2");
130 FAILED
("CONSTRAINT CHECKED TOO SOON - 2");
135 SUBTYPE SCONS
IS CONS
;
140 FAILED
("DISCRIMINANT CHECK NOT " &
142 IF X
/= (1, (1, 1)) THEN
143 COMMENT
("IRRELEVANT");
147 WHEN CONSTRAINT_ERROR
=>
150 FAILED
("UNEXPECTED EXCEPTION RAISED - 3");
154 FAILED
("CONSTRAINT CHECKED TOO SOON - 3");
159 TYPE ARR
IS ARRAY (1..5) OF CONS
;
164 FAILED
("DISCRIMINANT CHECK NOT " &
166 IF X
/= (1..5 => (1, (1, 1))) THEN
167 COMMENT
("IRRELEVANT");
171 WHEN CONSTRAINT_ERROR
=>
174 FAILED
("UNEXPECTED EXCEPTION RAISED - 4");
178 FAILED
("CONSTRAINT CHECKED TOO SOON - 4");
191 FAILED
("DISCRIMINANT CHECK NOT " &
193 IF X
/= (C1
=> (1, (1, 1))) THEN
194 COMMENT
("IRRELEVANT");
198 WHEN CONSTRAINT_ERROR
=>
201 FAILED
("UNEXPECTED EXCEPTION RAISED - 5");
205 FAILED
("CONSTRAINT CHECKED TOO SOON - 5");
210 TYPE DREC
IS NEW CONS
;
215 FAILED
("DISCRIMINANT CHECK NOT " &
217 IF X
/= (1, (1, 1)) THEN
218 COMMENT
("IRRELEVANT");
222 WHEN CONSTRAINT_ERROR
=>
225 FAILED
("UNEXPECTED EXCEPTION RAISED - 6");
229 FAILED
("CONSTRAINT CHECKED TOO SOON - 6");
238 FAILED
("CONSTRAINT CHECK DONE TOO EARLY");