CVS difference for ais/ai-00086.txt
--- ais/ai-00086.txt 1998/09/30 00:17:14 1.1
+++ ais/ai-00086.txt 1999/07/29 00:51:01 1.2
@@ -1,4 +1,4 @@
-!standard 12.07(0) (00) 97-05-27 AI95-00086/03
+!standard 12.07(0) (00) 99-07-28 AI95-00086/04
!class confirmation 95-08-19
!status WG9 approved (8-0-0) 97-07-04
!status ARG approved (5-0-2) 97-04-11
@@ -8,7 +8,7 @@
!difficulty Hard
!subject Passing generic formal packages with (<>)
-!summary 97-05-27
+!summary
If a generic formal package B whose actual part is (<>) is passed as an
actual to another generic formal package A without (<>), then 12.7(5-8)
@@ -16,14 +16,14 @@
this rule, the actuals of B are the entities denoted by names of the
form B.x, where x is a generic formal parameter of B.
-!question 97-05-27
+!question
If a generic formal package B whose actual part is (<>) is passed as an
actual to another generic formal package A without (<>), then 12.7(5-8)
requires the actuals of B to match the actuals of A. For the purpose of
this rule, what are the actuals of B?
-!response 97-05-27
+!response
12.7(5-8) require the actual parameters of the actual package to match
the actual parameters of the formal package. But if the actual package
@@ -94,8 +94,12 @@
The instantiation I2 is legal because the actual for T2 is FP3.T1,
which matches FP3.T1.
-!appendix 95-08-19
+!ACATS test
+Create a B-Test and a C-Test with the examples in this ruling.
+
+!appendix
+
!section 12.7(0)
!subject Generic Contract Model Violation ?
!reference AARM95-12.7;6.0
@@ -203,19 +207,19 @@
> complex matter and as far as I can see we have a contract model violation with
> the present rules. Consider the example (I'm sorry, but I don't think this
> example can be shorter):
->
->
+>
+>
> -- first the "template" in the sense of [AARM 12.7(4)]:
->
+>
> generic
> type T is private;
> package Template is
> X : T;
> end Template;
->
->
+>
+>
> -- then a formal package using the template:
->
+>
> with Template;
> generic
> type Ft1 is private;
@@ -223,10 +227,10 @@
> package G1 is
> Y : Ft1 := Formal_With_Actual.X;
> end G1;
->
->
+>
+>
> -- then another formal package using the template:
->
+>
> with Template;
> generic
> type Ft2 is private;
@@ -234,34 +238,34 @@
> package G2 is
> pragma Elaborate_Body; -- just to make a body for G2 legal
> end G2;
->
->
+>
+>
> -- then a unit instantiating G2:
->
+>
> with Template, G2;
> package Instantiator is
> package I1 is new Template( Integer );
> package I2 is new G2( Boolean, I1 );
> end Instantiator;
->
->
+>
+>
> -- so far nothing is wrong (all legality rules are fulfilled), but if the
> -- body of G2 contains an instantiation of G1 using its own formal
> -- parameters as the actuals, we have a problem:
->
+>
> with G1;
> package body G2 is
> package I3 is new G1( Ft2, Formal_With_Box );
-This violates 12.7(5), since the actual parameter of the
+This violates 12.7(5), since the actual parameter of the
"instance" Formal_With_Box is Formal_With_Box.T, and this does not
statically match Ft2.
> end G2;
->
-> This is a legal instantiation as far as I can see.
+>
+> This is a legal instantiation as far as I can see.
-No, it violates 12.7(5). When inside a generic, a
+No, it violates 12.7(5). When inside a generic, a
formal-package-with-box F looks like an instance whose
actual parameters are F.formal1, F.formal2, etc.
These "actual" parameters only match themselves for the purposes
Questions? Ask the ACAA Technical Agent