Ada: Implements overriding for tagged type primitives with First_Controlling_Parameter
This commit implements a rule for overriding primitives of tagged types that have the First_Controlling_Parameter aspect in Ada.
This commit implements a rule for overriding primitives of tagged types in Ada when they have the First_Controlling_Parameter aspect. When a derived type inherits this aspect, the compiler now ensures that the controlling formals of the overridden parent primitive are also inherited, maintaining consistent behavior in dispatching calls to these primitives.
In Details
The First_Controlling_Parameter aspect is related to dispatching in tagged types. This commit modifies sem_ch3.adb and sem_disp.adb to correctly handle the inheritance of controlling formals when overriding primitives. This ensures that dispatching works correctly for derived types. No interaction with other subsystems is apparent.
For Context
Tagged types in Ada enable polymorphism, where the specific subroutine executed depends on the 'tag' of the object at runtime. The First_Controlling_Parameter aspect guides dynamic dispatch. This commit enforces a rule about how subroutines (specifically, 'primitives') of these tagged types can be overridden in derived types, ensuring the correct method is called. This improves the reliability of polymorphic code.