diff --git a/src/core/model/ocarina-analyzer-aadl-names.adb b/src/core/model/ocarina-analyzer-aadl-names.adb index ee4fbb85b099442d4b87ab8bbac87d6b38a3e808..65c9decb8f8e26e8176458b1079b1c1136682dd7 100644 --- a/src/core/model/ocarina-analyzer-aadl-names.adb +++ b/src/core/model/ocarina-analyzer-aadl-names.adb @@ -161,19 +161,32 @@ package body Ocarina.Analyzer.AADL.Names is end if; pragma Assert (Present (Alias)); - In_Node := Node_Explicitly_In_Scope (Alias, Current_Scope); - - if In_Node = No_Node then + if Name (Alias) = Name (Build_Package_Identifier + (Package_Name (Package_Node))) + then + Display_Analyzer_Error + (Alias, "alias definition refer to self package", + Loc => Loc (Name_Visibility_Node)); Success := False; - Display_Analyzer_Error (Alias, "is not visible"); + + else + In_Node := Node_Explicitly_In_Scope + (Alias, Current_Scope); + + if In_Node = No_Node then + Success := False; + Display_Analyzer_Error (Alias, "is not visible"); + end if; end if; end; when others => null; end case; + exit when not Success; List_Node := Next_Node (List_Node); end loop; + Push_Scope (Entity_Scope (Package_Node)); return Success; end Check_Import_Declaration; @@ -630,7 +643,6 @@ package body Ocarina.Analyzer.AADL.Names is ---------------------------- function Check_Names_In_Package (Node : Node_Id) return Boolean is - pragma Assert (Kind (Node) = K_Package_Specification); Success : Boolean := True; @@ -647,7 +659,9 @@ package body Ocarina.Analyzer.AADL.Names is if not Enter_Name_In_Scope (Identifier (List_Node)) then Success := False; end if; + end if; + exit when not Success; List_Node := Next_Node (List_Node); end loop; diff --git a/tests/SAE-standard-examples-01192009/example_001.aadl.out b/tests/SAE-standard-examples-01192009/example_001.aadl.out index 00a80f951ec9f3889f309adfb452e3a956ebdf1c..31d10f4a5432066d1bda6be3c69e80ab49bbaad5 100644 --- a/tests/SAE-standard-examples-01192009/example_001.aadl.out +++ b/tests/SAE-standard-examples-01192009/example_001.aadl.out @@ -1,4 +1,3 @@ example_001.aadl:5:01: (package name) is not a package or a property set visible or existing example_001.aadl:5:27: Safety_Properties (identifier) is not a package or a property set visible or existing -example_001.aadl:10:43: Avionics::DataTypes::AirData (identifier) is not visible Cannot analyze AADL specifications diff --git a/tests/SAE-standard-examples-01192009/example_009.aadl.out b/tests/SAE-standard-examples-01192009/example_009.aadl.out index ec3e4bb7df9d68355972f0f13f76ab7f3b030d36..79a120e6d151643433cfe6d7f5bda960327fe179 100644 --- a/tests/SAE-standard-examples-01192009/example_009.aadl.out +++ b/tests/SAE-standard-examples-01192009/example_009.aadl.out @@ -1,4 +1,3 @@ example_009.aadl:7:06: base_types (identifier) is not a package or a property set visible or existing example_009.aadl:78:06: base_types (identifier) is not a package or a property set visible or existing -example_009.aadl:81:29: "Address.others" conflicts with declaration at line 66 Cannot analyze AADL specifications diff --git a/tests/SAE-standard-examples-01192009/example_015.aadl.out b/tests/SAE-standard-examples-01192009/example_015.aadl.out index 3be201b242e7c93ff01bbb38975821068d714674..0284e477f1491cfe8b076e06bb6d71e95b8ec958 100644 --- a/tests/SAE-standard-examples-01192009/example_015.aadl.out +++ b/tests/SAE-standard-examples-01192009/example_015.aadl.out @@ -1,3 +1,2 @@ example_015.aadl:6:08: Buses (identifier) is not a package or a property set visible or existing -example_015.aadl:7:08: UserTypes (identifier) is not a package or a property set visible or existing Cannot analyze AADL specifications diff --git a/tests/test027/test.aadl.out b/tests/test027/test.aadl.out index ff85d0de13bc89dd5b3bc9ed672d8e6ab41f2a44..5bec77210b0a380d8288db5446263d735991211a 100644 --- a/tests/test027/test.aadl.out +++ b/tests/test027/test.aadl.out @@ -1,10 +1,2 @@ test.aadl:5:05: (package name) is not a package or a property set visible or existing -test.aadl:6:05: (package name) is not a package or a property set visible or existing -test.aadl:7:05: (package name) is not a package or a property set visible or existing -: Security::Verification::Position (identifier) is not visible -test.aadl:11:49: Control::Target::Proc.Impl (identifier) is not visible -test.aadl:12:27: thefeature (identifier) is not visible -: Command::Launcher (identifier) is not visible -: Foo (identifier) is not visible -test.aadl:23:05: (package name) is not a package or a property set visible or existing Cannot analyze AADL specifications