[Ada] Do expect task discriminants in Global and Depends contracts
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 1 Apr 2020 16:19:40 +0000 (18:19 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 15 Jun 2020 08:04:40 +0000 (04:04 -0400)
2020-06-15  Piotr Trojanek  <trojanek@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

index eb374c4bb7ad8d682273b81fbfad3a8ff4e2a8a8..673954acb5bf1c2d72ac894ce4daf106de4f1b10 100644 (file)
@@ -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);