Ada: Implement AI22-0154 (Revised resolution of indexing aspects)
The Ada compiler now correctly handles indexing aspects, adhering to the revised rules specified in AI22-0154, improving code legality and diagnostics.
This commit implements Ada language change AI22-0154, which revises the rules for resolving indexing aspects. The original rules could incorrectly flag code as illegal due to functions inherited from parent types. The new implementation considers indexing profile requirements, allowing the compiler to accept previously rejected code. The compiler now also issues warnings for ineligible candidate entities, and code related to inherited indexing functions has been refactored.
In Details
This commit modifies sem_ch6.adb and sem_ch13.ads to implement AI22-0154, focusing on the resolution of indexing aspects. It revises how the compiler checks the legality of functions used in indexing aspects, considering the indexing profile requirements. It also encompasses changes related to AI22-0159/01. The changes involve modifications to Check_Function_For_Indexing_Aspect and Check_Indexing_Functions. Familiarity with the Ada semantics, particularly aspect resolution, is needed to understand the implications.
For Context
This commit modifies the Ada compiler to better handle a specific language feature called "indexing aspects." Indexing aspects let you define how you access elements within a data structure (like an array). A recent change to the Ada language specification (AI22-0154) clarified the rules for how the compiler chooses the correct function to use when indexing. This commit implements these revised rules, which fixes errors in some existing code and improves the overall consistency of the language. The compiler will also now provide more informative warnings when it encounters problems with indexing aspects.