[Ada] AI12-0307: uniform resolution rules for aggregates
gcc/ada/ * sem_util.ads, sem_util.adb (Check_Ambiguous_Aggregate): When a subprogram call is found to be ambiguous, check whether ambiguity is caused by an aggregate actual. and indicate that it should carry a type qualification. * sem_ch4.adb (Traverse_Hoonyms, Try_Primitive_Operation): Call it. * sem_res.adb (Report_Ambiguous_Argument): Call it.
This commit is contained in:
parent
1c583927a5
commit
c448859271
|
@ -9339,6 +9339,7 @@ package body Sem_Ch4 is
|
|||
Error_Msg_NE ("ambiguous call to&", N, Hom);
|
||||
Report_Ambiguity (Matching_Op);
|
||||
Report_Ambiguity (Hom);
|
||||
Check_Ambiguous_Aggregate (New_Call_Node);
|
||||
Error := True;
|
||||
return;
|
||||
end if;
|
||||
|
@ -9961,6 +9962,7 @@ package body Sem_Ch4 is
|
|||
Error_Msg_NE ("ambiguous call to&", N, Prim_Op);
|
||||
Report_Ambiguity (Matching_Op);
|
||||
Report_Ambiguity (Prim_Op);
|
||||
Check_Ambiguous_Aggregate (Call_Node);
|
||||
return True;
|
||||
end if;
|
||||
end if;
|
||||
|
|
|
@ -2097,7 +2097,8 @@ package body Sem_Res is
|
|||
then
|
||||
Error_Msg_NE ("ambiguous call to&", Arg, Name (Arg));
|
||||
|
||||
-- Could use comments on what is going on here???
|
||||
-- Examine possible interpretations, and adapt the message
|
||||
-- for inherited subprograms declared by a type derivation.
|
||||
|
||||
Get_First_Interp (Name (Arg), I, It);
|
||||
while Present (It.Nam) loop
|
||||
|
@ -2112,6 +2113,11 @@ package body Sem_Res is
|
|||
Get_Next_Interp (I, It);
|
||||
end loop;
|
||||
end if;
|
||||
|
||||
-- Additional message and hint if the ambiguity involves an Ada2020
|
||||
-- container aggregate.
|
||||
|
||||
Check_Ambiguous_Aggregate (N);
|
||||
end Report_Ambiguous_Argument;
|
||||
|
||||
-----------------------
|
||||
|
|
|
@ -2425,6 +2425,27 @@ package body Sem_Util is
|
|||
end if;
|
||||
end Cannot_Raise_Constraint_Error;
|
||||
|
||||
-------------------------------
|
||||
-- Check_Ambiguous_Aggregate --
|
||||
-------------------------------
|
||||
|
||||
procedure Check_Ambiguous_Aggregate (Call : Node_Id) is
|
||||
Actual : Node_Id;
|
||||
|
||||
begin
|
||||
if Extensions_Allowed then
|
||||
Actual := First_Actual (Call);
|
||||
while Present (Actual) loop
|
||||
if Nkind (Actual) = N_Aggregate then
|
||||
Error_Msg_N
|
||||
("\add type qualification to aggregate actual", Actual);
|
||||
exit;
|
||||
end if;
|
||||
Next_Actual (Actual);
|
||||
end loop;
|
||||
end if;
|
||||
end Check_Ambiguous_Aggregate;
|
||||
|
||||
-----------------------------------------
|
||||
-- Check_Dynamically_Tagged_Expression --
|
||||
-----------------------------------------
|
||||
|
|
|
@ -349,6 +349,13 @@ package Sem_Util is
|
|||
-- not necessarily mean that CE could be raised, but a response of True
|
||||
-- means that for sure CE cannot be raised.
|
||||
|
||||
procedure Check_Ambiguous_Aggregate (Call : Node_Id);
|
||||
-- Additional information on an ambiguous call in Ada_2020 when a
|
||||
-- subprogram call has an actual that is an aggregate, and the
|
||||
-- presence of container aggregates (or types with the correwponding
|
||||
-- aspect) provides an additional interpretation. Message indicates
|
||||
-- that an aggregate actual should carry a type qualification.
|
||||
|
||||
procedure Check_Dynamically_Tagged_Expression
|
||||
(Expr : Node_Id;
|
||||
Typ : Entity_Id;
|
||||
|
|
Loading…
Reference in New Issue