]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/ada/sem_type.adb
[Ada] Reuse Is_Package_Or_Generic_Package where possible
[thirdparty/gcc.git] / gcc / ada / sem_type.adb
index b499117e743c6d61850a449d87290fd9c96d4789..1868568c5eaba1229a78ab087be1acb4c73df2e7 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2018, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2019, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -1383,7 +1383,7 @@ package body Sem_Type is
       begin
          return In_Same_List (Parent (Typ), Op_Decl)
            or else
-             (Ekind_In (Scop, E_Package, E_Generic_Package)
+             (Is_Package_Or_Generic_Package (Scop)
                and then List_Containing (Op_Decl) =
                               Visible_Declarations (Parent (Scop))
                and then List_Containing (Parent (Typ)) =
@@ -2286,12 +2286,13 @@ package body Sem_Type is
       --  ration "type P is access Integer" and an anonymous access to Integer,
       --  P is convertible to "access Integer" by 4.6 (24.11-24.15), but there
       --  is no rule in 4.6 that allows "access Integer" to be converted to P.
+      --  Note that this does not preclude one operand to be a pool-specific
+      --  access type, as a previous version of this code enforced.
 
       elsif Ada_Version >= Ada_2005
         and then Ekind_In (Etype (L), E_Anonymous_Access_Type,
                                       E_Anonymous_Access_Subprogram_Type)
         and then Is_Access_Type (Etype (R))
-        and then Ekind (Etype (R)) /= E_Access_Type
       then
          return Etype (L);
 
@@ -2299,7 +2300,6 @@ package body Sem_Type is
         and then Ekind_In (Etype (R), E_Anonymous_Access_Type,
                                       E_Anonymous_Access_Subprogram_Type)
         and then Is_Access_Type (Etype (L))
-        and then Ekind (Etype (L)) /= E_Access_Type
       then
          return Etype (R);
 
@@ -2849,7 +2849,7 @@ package body Sem_Type is
          return False;
 
       else
-         return In_Generic_Actual (Parent (Par));
+         return In_Generic_Actual (Par);
       end if;
    end In_Generic_Actual;
 
@@ -3608,8 +3608,10 @@ package body Sem_Type is
       Print_Node_Briefly (N);
 
       if not Is_Overloaded (N) then
-         Write_Line ("Non-overloaded entity ");
-         Write_Entity_Info (Entity (N), " ");
+         if Is_Entity_Name (N) then
+            Write_Line ("Non-overloaded entity ");
+            Write_Entity_Info (Entity (N), " ");
+         end if;
 
       elsif Nkind (N) not in N_Has_Entity then
          Get_First_Interp (N, I, It);