When the support for Global and Depends (and their Refined variants)
contracts was implemented, it wrongly allowed discriminants to appear in
these contracts. This was later fixed, but we still had task
discriminants installed when resolving the contract items.

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): Do not install task discriminants
        for analysis of the Global/Depends contracts.
--- gcc/ada/sem_prag.adb
+++ gcc/ada/sem_prag.adb
@@ -2001,9 +2001,7 @@ package body Sem_Prag is
                Push_Scope (Spec_Id);
 
                if Ekind (Spec_Id) = E_Task_Type then
-                  if Has_Discriminants (Spec_Id) then
-                     Install_Discriminants (Spec_Id);
-                  end if;
+                  null;
 
                elsif Is_Generic_Subprogram (Spec_Id) then
                   Install_Generic_Formals (Spec_Id);
@@ -2791,9 +2789,7 @@ package body Sem_Prag is
             Push_Scope (Spec_Id);
 
             if Ekind (Spec_Id) = E_Task_Type then
-               if Has_Discriminants (Spec_Id) then
-                  Install_Discriminants (Spec_Id);
-               end if;
+               null;
 
             elsif Is_Generic_Subprogram (Spec_Id) then
                Install_Generic_Formals (Spec_Id);

Reply via email to