]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix checking of Refined_State with nested package renamings
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 23 Sep 2022 17:06:54 +0000 (19:06 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 29 Sep 2022 09:08:46 +0000 (11:08 +0200)
When collecting package state declared in package body, we should only
recursively examine the visible part of nested packages while ignoring other
entities related to packages (e.g. package bodies or package renamings).

gcc/ada/

* sem_util.adb (Collect_Visible_States): Ignore package renamings.

gcc/ada/sem_util.adb

index 9ae082ca2e19c3194172ceffdc35aa2a2519e91b..25e886e1ca14d3577c39eabf6852aecaee142c03 100644 (file)
@@ -6018,8 +6018,11 @@ package body Sem_Util is
                Append_New_Elmt (Item_Id, States);
 
             --  Recursively gather the visible states of a nested package
+            --  except for nested package renamings.
 
-            elsif Ekind (Item_Id) = E_Package then
+            elsif Ekind (Item_Id) = E_Package
+              and then No (Renamed_Entity (Item_Id))
+            then
                Collect_Visible_States (Item_Id, States);
             end if;