]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Refactor code of Check_Ambiguous_Call and Valid_Conversion
authorJavier Miranda <miranda@adacore.com>
Fri, 29 Nov 2024 11:05:31 +0000 (11:05 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 13 Dec 2024 08:36:01 +0000 (09:36 +0100)
gcc/ada/ChangeLog:

* sem_res.adb (Report_Ambiguous_Argument): Code cleanup.
(Resolve): Code cleanup.

gcc/ada/sem_res.adb

index cd75508021c5efce56bc13fffd63aeb3ff62fb4f..948ed940481bb1e98295ec45003481e087be14d9 100644 (file)
@@ -2435,14 +2435,7 @@ package body Sem_Res is
 
             Get_First_Interp (Name (Arg), I, It);
             while Present (It.Nam) loop
-               Error_Msg_Sloc := Sloc (It.Nam);
-
-               if Nkind (Parent (It.Nam)) = N_Full_Type_Declaration then
-                  Error_Msg_N ("interpretation (inherited) #!", Arg);
-               else
-                  Error_Msg_N ("interpretation #!", Arg);
-               end if;
-
+               Report_Interpretation (Arg, It.Nam, It.Typ);
                Get_Next_Interp (I, It);
             end loop;
          end if;
@@ -2823,13 +2816,10 @@ package body Sem_Res is
 
                         Ambiguous := True;
 
-                        if Nkind (Parent (Seen)) = N_Full_Type_Declaration then
-                           Error_Msg_N
-                             ("\\possible interpretation (inherited)#!", N);
-                        else
-                           Error_Msg_N -- CODEFIX
-                             ("\\possible interpretation#!", N);
-                        end if;
+                        Report_Interpretation
+                          (N   => N,
+                           Nam => Seen,
+                           Typ => Etype (Seen));
 
                         if Nkind (N) in N_Subprogram_Call
                           and then Present (Parameter_Associations (N))
@@ -2912,8 +2902,8 @@ package body Sem_Res is
                      elsif
                        Nkind (Parent (It.Nam)) = N_Full_Type_Declaration
                      then
-                        Error_Msg_N
-                          ("\\possible interpretation (inherited)#!", N);
+                        Report_Interpretation (N, It.Nam, It.Typ);
+
                      else
                         Error_Msg_N -- CODEFIX
                           ("\\possible interpretation#!", N);