From 0c5810f8f576f59a92a2863c4e6408b04590e863 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 24 Apr 2018 18:52:53 +0200 Subject: Improve error message for #560. --- src/vhdl/sem_names.adb | 10 +++++++++- src/vhdl/sem_scopes.ads | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb index d8d7dea6e..141563292 100644 --- a/src/vhdl/sem_names.adb +++ b/src/vhdl/sem_names.adb @@ -1830,7 +1830,15 @@ package body Sem_Names is if not Valid_Interpretation (Interpretation) then -- Unknown name. if not Soft then - Error_Msg_Sem (+Name, "no declaration for %i", +Name); + Interpretation := Get_Interpretation_Raw (Id); + if Valid_Interpretation (Interpretation) + and then Is_Conflict_Declaration (Interpretation) + then + Error_Msg_Sem + (+Name, "no declaration for %i (due to conflicts)", +Name); + else + Error_Msg_Sem (+Name, "no declaration for %i", +Name); + end if; end if; Res := Error_Mark; elsif not Valid_Interpretation (Get_Next_Interpretation (Interpretation)) diff --git a/src/vhdl/sem_scopes.ads b/src/vhdl/sem_scopes.ads index 6942c5430..3503d4fb6 100644 --- a/src/vhdl/sem_scopes.ads +++ b/src/vhdl/sem_scopes.ads @@ -105,6 +105,16 @@ package Sem_Scopes is return Boolean; pragma Inline (Is_In_Current_Declarative_Region); + -- Return the raw interpretation of ID. To be used only in case of + -- invalid interpretation to clarify the issue: this may be due to + -- conflicting declarations. + function Get_Interpretation_Raw (Id : Name_Id) + return Name_Interpretation_Type; + + -- Return True iff NI is a conflicting declaration. + function Is_Conflict_Declaration (Ni : Name_Interpretation_Type) + return Boolean; + -- Push and pop all interpretations. -- This can be used to suspend name interpretation, in case of recursive -- semantics. -- cgit v1.2.3