Ada: Reject non-primitive operations in Finalizable aspect.
The Ada compiler now enforces that only primitive operations can be used in the `Finalizable` aspect.
The Ada compiler now enforces a restriction that only primitive operations can be used within the Finalizable aspect. This change aligns with the intended implementation, prevents unsupported behavior, and simplifies the compiler. This ensures that finalization procedures are correctly defined and executed.
In Details
The sem_ch13.adb file handles semantic analysis related to aspects. The Resolve_Finalization_Procedure.Is_Finalizable_Primitive procedure now requires the procedure to be a primitive operation. The documentation in gnat_rm/gnat_language_extensions.rst has been updated to reflect this restriction.
For Context
In Ada, finalization is a mechanism for executing code when an object is no longer needed. The Finalizable aspect allows you to specify procedures to be run during finalization. This commit enforces a rule that only primitive operations (operations directly associated with a type) can be used as finalization procedures. This restriction simplifies the implementation and ensures that finalization works as expected.