|
| 1 | +package Main is |
| 2 | + function Process_Int (I : Integer) return Boolean is (I = 0); |
| 3 | + |
| 4 | + -- Test with tagged types |
| 5 | + |
| 6 | + type T_Pre is tagged null record; |
| 7 | + function F (V : T_Pre) return Integer is (0) |
| 8 | + with Pre'Class => Predicate (T_Pre'(Make)); |
| 9 | + function Predicate (V : T_Pre) return Boolean is (False); |
| 10 | + function Make return T_Pre is (null record); |
| 11 | + |
| 12 | + type T_Pre_Pragma is tagged null record; |
| 13 | + function F (V : T_Pre_Pragma) return Integer is (0); |
| 14 | + pragma Pre_Class (Predicate (T_Pre_Pragma'(Make))); |
| 15 | + function Predicate (V : T_Pre_Pragma) return Boolean is (False); |
| 16 | + function Make return T_Pre_Pragma is (null record); |
| 17 | + |
| 18 | + type T_Post is tagged null record; |
| 19 | + function F (V : T_Post) return Integer is (0) |
| 20 | + with Post'Class => T_Post'(Make).Predicate; |
| 21 | + function Predicate (V : T_Post) return Boolean is (False); |
| 22 | + function Make return T_Post is (null record); |
| 23 | + |
| 24 | + type T_Post_Pragma is tagged null record; |
| 25 | + function F (V : T_Post_Pragma) return Integer is (0); |
| 26 | + pragma Post_Class (Predicate (T_Post_Pragma'(Make))); |
| 27 | + function Predicate (V : T_Post_Pragma) return Boolean is (False); |
| 28 | + function Make return T_Post_Pragma is (null record); |
| 29 | + |
| 30 | + type T_Post_Result is tagged record |
| 31 | + I : Integer; |
| 32 | + end record; |
| 33 | + function F (V : T_Post_Result) return Integer is (0) |
| 34 | + with Post'Class => T_Post_Result'(Make (F'Result)).I = 0; |
| 35 | + function Make (I : Integer) return T_Post_Result is ((I => I)); |
| 36 | + |
| 37 | + type T_Pre_Ref_Formal is tagged record |
| 38 | + I : Integer; |
| 39 | + end record; |
| 40 | + function F (V : T_Pre_Ref_Formal; I : Integer) return Integer is (0) |
| 41 | + with Pre'Class => T_Pre_Ref_Formal'(Make (I)).I = 0; |
| 42 | + function Make (I : Integer) return T_Pre_Ref_Formal is ((I => I)); |
| 43 | + |
| 44 | + type T_Pre_Ref_Prefix is tagged null record; |
| 45 | + function F (V : T_Pre_Ref_Prefix) return Integer is (0) |
| 46 | + with Pre'Class => V.Predicate; |
| 47 | + function Predicate (V : T_Pre_Ref_Prefix) return Boolean is (False); |
| 48 | + |
| 49 | + type T_Pre_No_Prim_Call is tagged null record; |
| 50 | + function F (V : T_Pre_No_Prim_Call) return Integer is (0) |
| 51 | + with Pre'Class => Process_Int (0); |
| 52 | + |
| 53 | + type T_Pre_No_Call is tagged null record; |
| 54 | + function F (V : T_Pre_No_Call) return Integer is (0) |
| 55 | + with Pre'Class => False; |
| 56 | + |
| 57 | + type T_Pre_Not_Class is tagged null record; |
| 58 | + function F (V : T_Pre_Not_Class) return Integer is (0) |
| 59 | + with Pre => Predicate (T_Pre_Not_Class'(Make)); |
| 60 | + function Predicate (V : T_Pre_Not_Class) return Boolean is (False); |
| 61 | + function Make return T_Pre_Not_Class is (null record); |
| 62 | + |
| 63 | + type Child_Pre is new T_Pre with null record; -- FLAG |
| 64 | + type Child_Child_Pre is new Child_Pre with null record; -- FLAG |
| 65 | + type Child_Pre_Pragma is new T_Pre_Pragma with null record; -- FLAG |
| 66 | + type Child_Post is new T_Post with null record; -- FLAG |
| 67 | + type Child_Post_Pragma is new T_Post_Pragma with null record; -- FLAG |
| 68 | + type Child_Post_Result is new T_Post_Result with null record; -- NOFLAG |
| 69 | + type Child_Pre_Ref_Formal is new T_Pre_Ref_Formal with null record; -- NOFLAG |
| 70 | + type Child_Pre_Ref_Prefix is new T_Pre_Ref_Prefix with null record; -- NOFLAG |
| 71 | + type Child_No_Prim_Call is new T_Pre_No_Prim_Call with null record; -- NOFLAG |
| 72 | + type Child_Pre_No_Call is new T_Pre_No_Call with null record; -- NOFLAG |
| 73 | + type Child_Pre_Not_Class is new T_Pre_Not_Class with null record; -- NOFLAG |
| 74 | +end Main; |
0 commit comments