This reverts a previous commit and reinstalls task discriminants for the
analysis of Global/Depends contracts (and their refined variants). Task
discriminants are rejected in those contracts, but need to be installed
for the analysis, as otherwise we get difficult to understand error
messages.
Tested on x86_64-pc-linux-gnu, committed on trunk
2020-06-15 Piotr Trojanek <troja...@adacore.com>
gcc/ada/
* sem_prag.adb (Analyze_Depends_In_Decl_Part,
Analyze_Global_In_Decl_Part): Bring back task discriminants for
analysis of the Global/Depends contracts; add comments.
--- gcc/ada/sem_prag.adb
+++ gcc/ada/sem_prag.adb
@@ -2001,7 +2001,14 @@ package body Sem_Prag is
Push_Scope (Spec_Id);
if Ekind (Spec_Id) = E_Task_Type then
- null;
+
+ -- Task discriminants cannot appear in the [Refined_]Depends
+ -- contract, but must be present for the analysis so that we
+ -- can reject them with an informative error message.
+
+ if Has_Discriminants (Spec_Id) then
+ Install_Discriminants (Spec_Id);
+ end if;
elsif Is_Generic_Subprogram (Spec_Id) then
Install_Generic_Formals (Spec_Id);
@@ -2789,7 +2796,14 @@ package body Sem_Prag is
Push_Scope (Spec_Id);
if Ekind (Spec_Id) = E_Task_Type then
- null;
+
+ -- Task discriminants cannot appear in the [Refined_]Global
+ -- contract, but must be present for the analysis so that we
+ -- can reject them with an informative error message.
+
+ if Has_Discriminants (Spec_Id) then
+ Install_Discriminants (Spec_Id);
+ end if;
elsif Is_Generic_Subprogram (Spec_Id) then
Install_Generic_Formals (Spec_Id);