From 88981bf9b355d27acf86718aa60d80582a9620db Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 22 Dec 2016 08:09:55 +0100 Subject: Improve error message for #243 --- src/vhdl/sem_names.adb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/vhdl') diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb index 474bd799d..b7c4a41b9 100644 --- a/src/vhdl/sem_names.adb +++ b/src/vhdl/sem_names.adb @@ -3820,6 +3820,26 @@ package body Sem_Names is Add_Result (Res, El); end if; end loop; + if Res = Null_Iir then + -- Specific error message for a non-visible enumeration + -- literal. + if (Get_Kind (Get_Base_Type (A_Type)) + = Iir_Kind_Enumeration_Type_Definition) + and then Kind_In (Name, Iir_Kind_Simple_Name, + Iir_Kind_Character_Literal) + then + Res := Find_Name_In_List (Get_Enumeration_Literal_List + (Get_Base_Type (A_Type)), + Get_Identifier (Name)); + if Res /= Null_Iir then + Error_Msg_Sem + (+Name, "enumeration literal %i is not visible " + & "(add a use clause)", +Name); + -- Keep the literal as result. + end if; + end if; + end if; + if Res = Null_Iir then Error_Not_Match (Name, A_Type); return Create_Error_Expr (Name, A_Type); -- cgit v1.2.3