(Make_Representation_Too_Late_Error (Rep, Freeze, Def));
end Record_Representation_Too_Late_Error;
+ ------------------------------------------
+ -- Make_Mixed_Container_Aggregate_Error --
+ ------------------------------------------
+
+ function Make_Mixed_Container_Aggregate_Error
+ (Aggr : Node_Id;
+ Pos_Elem : Node_Id;
+ Named_Elem : Node_Id) return Diagnostic_Type
+ is
+
+ begin
+ return
+ Make_Diagnostic
+ (Msg =>
+ "container aggregate cannot be both positional and named",
+ Location => Primary_Labeled_Span (Aggr),
+ Id => GNAT0011,
+ Kind => Diagnostics.Error,
+ Spans =>
+ (1 => Secondary_Labeled_Span
+ (Pos_Elem, "positional element "),
+ 2 => Secondary_Labeled_Span
+ (Named_Elem, "named element")));
+ end Make_Mixed_Container_Aggregate_Error;
+
+ --------------------------------------------
+ -- Record_Mixed_Container_Aggregate_Error --
+ --------------------------------------------
+
+ procedure Record_Mixed_Container_Aggregate_Error
+ (Aggr : Node_Id;
+ Pos_Elem : Node_Id;
+ Named_Elem : Node_Id)
+ is
+ begin
+ Record_Diagnostic
+ (Make_Mixed_Container_Aggregate_Error (Aggr, Pos_Elem, Named_Elem));
+ end Record_Mixed_Container_Aggregate_Error;
+
end Diagnostics.Constructors;
Freeze : Node_Id;
Def : Node_Id);
+ function Make_Mixed_Container_Aggregate_Error
+ (Aggr : Node_Id;
+ Pos_Elem : Node_Id;
+ Named_Elem : Node_Id) return Diagnostic_Type;
+
+ procedure Record_Mixed_Container_Aggregate_Error
+ (Aggr : Node_Id;
+ Pos_Elem : Node_Id;
+ Named_Elem : Node_Id);
+
end Diagnostics.Constructors;
(Status => Active,
Human_Id => new String'("Representation_Too_Late_Error"),
Documentation => new String'("./error_codes/GNAT0010.md"),
+ Switch => No_Switch_Id),
+ GNAT0011 =>
+ (Status => Active,
+ Human_Id => new String'("Mixed_Container_Aggregate_Error"),
+ Documentation => new String'("./error_codes/GNAT0011.md"),
Switch => No_Switch_Id));
procedure Print_Diagnostic_Repository;
GNAT0007,
GNAT0008,
GNAT0009,
- GNAT0010);
+ GNAT0010,
+ GNAT0011);
-- Labeled_Span_Type represents a span of source code that is associated
-- with a textual label. Primary spans indicate the primary location of the
| N_Declaration
| N_Access_To_Subprogram_Definition
| N_Generic_Instantiation
+ | N_Component_Association
+ | N_Iterated_Component_Association
| N_Later_Decl_Item
| N_Use_Package_Clause
| N_Array_Type_Definition
with Aspects; use Aspects;
with Atree; use Atree;
with Checks; use Checks;
+with Debug; use Debug;
+with Diagnostics.Constructors; use Diagnostics.Constructors;
with Einfo; use Einfo;
with Einfo.Utils; use Einfo.Utils;
with Elists; use Elists;
Empty_Subp, Add_Named_Subp, Add_Unnamed_Subp,
New_Indexed_Subp, Assign_Indexed_Subp);
+ if Present (First (Expressions (N)))
+ and then Present (First (Component_Associations (N)))
+ then
+ if Debug_Flag_Underscore_DD then
+ Record_Mixed_Container_Aggregate_Error
+ (Aggr => N,
+ Pos_Elem => First (Expressions (N)),
+ Named_Elem => First (Component_Associations (N)));
+ else
+ Error_Msg_N
+ ("container aggregate cannot be both positional and named", N);
+ end if;
+ return;
+ end if;
+
if Present (Add_Unnamed_Subp)
and then No (New_Indexed_Subp)
and then Present (Etype (Add_Unnamed_Subp))
if Present (Component_Associations (N))
and then not Is_Empty_List (Component_Associations (N))
then
- if Present (Expressions (N))
- and then not Is_Empty_List (Expressions (N))
- then
- Error_Msg_N ("container aggregate cannot be "
- & "both positional and named", N);
- return;
- end if;
-
Comp := First (Component_Associations (N));
while Present (Comp) loop