This patch suppresses the check for compatibility of the component types of the formal and the corresponding actual in the instantiation of a generic child unit, when the component type of the formal is itself a formal of an enclosing generic unit. This removes spurious conformance errors in complex sets of nested instantiations of generic hierarchies.
No short example available. Tested on x86_64-pc-linux-gnu, committed on trunk 2017-09-08 Ed Schonberg <schonb...@adacore.com> * sem_ch12.adb (Validate_Array_Type_Instance): Suppress check for compatibility of component types of formal and actual in an instantiation of a child unit, when the component type of the formal is itself a formal of an enclosing generic.
Index: sem_ch12.adb =================================================================== --- sem_ch12.adb (revision 251869) +++ sem_ch12.adb (working copy) @@ -12080,7 +12080,10 @@ -- for static matching has failed. The case where both the component -- type and the array type are separate formals, and the component -- type is a private view may also require special checking in - -- Subtypes_Match. + -- Subtypes_Match. Finally, we assume that a child instance where + -- the component type comes from a formal of a parent instance is + -- correct because the generic was correct. A more precise check + -- seems too complex to install??? if Subtypes_Match (Component_Type (A_Gen_T), Component_Type (Act_T)) @@ -12088,6 +12091,9 @@ Subtypes_Match (Find_Actual_Type (Component_Type (A_Gen_T), A_Gen_T), Component_Type (Act_T)) + or else + (not Inside_A_Generic + and then Is_Child_Unit (Scope (Component_Type (A_Gen_T)))) then null; else