(Is_Null_Extension (Etype (Subp))
and then Etype (Alias (Subp)) /= Etype (Subp))
then
+ -- If there is a non-overloadable homonym in the current
+ -- scope, the implicit declaration remains invisible.
+ -- We check the current entity with the same name, or its
+ -- homonym in case the derivation takes place after the
+ -- hiding object declaration.
+
+ if Present (Current_Entity (Subp)) then
+ declare
+ Curr : constant Entity_Id := Current_Entity (Subp);
+ Prev : constant Entity_Id := Homonym (Curr);
+ begin
+ if (Comes_From_Source (Curr)
+ and then Scope (Curr) = Current_Scope
+ and then not Is_Overloadable (Curr))
+ or else
+ (Present (Prev)
+ and then Comes_From_Source (Prev)
+ and then Scope (Prev) = Current_Scope
+ and then not Is_Overloadable (Prev))
+ then
+ goto Next_Prim;
+ end if;
+ end;
+ end if;
+
Formal_List := No_List;
Formal := First_Formal (Subp);
return Position.Container.Nodes (Position.Node).Element;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 10) return List is
+ begin
+ return Result : List (Capacity) do
+ null;
+ end return;
+ end Empty;
+
--------------
-- Finalize --
--------------
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_List,
+ Aggregate => (Empty => Empty,
Add_Unnamed => Append_One);
pragma Preelaborable_Initialization (List);
No_Element : constant Cursor;
+ function Empty (Capacity : Count_Type := 10) return List;
+
function Has_Element (Position : Cursor) return Boolean;
package List_Iterator_Interfaces is new
return Position.Container.Nodes (Position.Node).Element;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type) return Map is
+ begin
+ return Result : Map (Capacity, 0) do
+ null;
+ end return;
+ end Empty;
+
-------------------------
-- Equivalent_Key_Node --
-------------------------
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_Map,
+ Aggregate => (Empty => Empty,
Add_Named => Insert);
pragma Preelaborable_Initialization (Map);
-- Map objects declared without an initialization expression are
-- initialized to the value Empty_Map.
+ function Empty (Capacity : Count_Type) return Map;
+
No_Element : constant Cursor;
-- Cursor objects declared without an initialization expression are
-- initialized to the value No_Element.
end;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 10) return Set is
+ begin
+ return Result : Set (Capacity, 0) do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
---------------------
-- Equivalent_Sets --
---------------------
with Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_Set,
+ Aggregate => (Empty => Empty,
Add_Unnamed => Include);
pragma Preelaborable_Initialization (Set);
-- Set objects declared without an initialization expression are
-- initialized to the value Empty_Set.
+ function Empty (Capacity : Count_Type := 10) return Set;
+
No_Element : constant Cursor;
-- Cursor objects declared without an initialization expression are
-- initialized to the value No_Element.
return Container.Nodes (Node).Element;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 10) return Map is
+ begin
+ return Result : Map (Capacity) do
+ null;
+ end return;
+ end Empty;
+
---------------------
-- Equivalent_Keys --
---------------------
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_Map,
+ Aggregate => (Empty => Empty,
Add_Named => Insert);
pragma Preelaborable_Initialization (Map);
Empty_Map : constant Map;
+ function Empty (Capacity : Count_Type := 10) return Map;
+
No_Element : constant Cursor;
function Has_Element (Position : Cursor) return Boolean;
return Position.Container.Nodes (Position.Node).Element;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 10) return Set is
+ begin
+ return Result : Set (Capacity) do
+ null;
+ end return;
+ end Empty;
+
-------------------------
-- Equivalent_Elements --
-------------------------
with Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_Set,
+ Aggregate => (Empty => Empty,
Add_Unnamed => Include);
pragma Preelaborable_Initialization (Set);
Empty_Set : constant Set;
+ function Empty (Capacity : Count_Type := 10) return Set;
+
No_Element : constant Cursor;
function Has_Element (Position : Cursor) return Boolean;
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_List,
+ Aggregate => (Empty => Empty,
Add_Unnamed => Append_One);
pragma Preelaborable_Initialization (List);
pragma Preelaborable_Initialization (Cursor);
Empty_List : constant List;
+ function Empty return List;
No_Element : constant Cursor;
-- Returns a pointer to the element designated by Position.
Empty_List : constant List := (Controlled with others => <>);
+ function Empty return List is (Empty_List);
No_Element : constant Cursor := Cursor'(null, null);
Insert (Container, No_Element, New_Item, Count);
end Append;
+ ---------------
+ -- Append_One --
+ ---------------
+
+ procedure Append_One
+ (Container : in out List;
+ New_Item : Element_Type)
+ is
+ begin
+ Insert (Container, No_Element, New_Item, 1);
+ end Append_One;
+
------------
-- Assign --
------------
Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Unnamed => Append_One);
pragma Preelaborable_Initialization (List);
pragma Preelaborable_Initialization (Cursor);
Empty_List : constant List;
+ function Empty return List;
No_Element : constant Cursor;
New_Item : Element_Type;
Count : Count_Type := 1);
+ procedure Append_One
+ (Container : in out List;
+ New_Item : Element_Type);
+
procedure Delete
(Container : in out List;
Position : in out Cursor;
-- Returns a pointer to the element designated by Position.
Empty_List : constant List := List'(Controlled with others => <>);
+ function Empty return List is (Empty_List);
No_Element : constant Cursor := Cursor'(null, null);
return Position.Node.Element.all;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 1000) return Map is
+ begin
+ return Result : Map do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
-------------------------
-- Equivalent_Key_Node --
-------------------------
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_Map,
+ Aggregate => (Empty => Empty,
Add_Named => Insert);
pragma Preelaborable_Initialization (Map);
-- Map objects declared without an initialization expression are
-- initialized to the value Empty_Map.
+ function Empty (Capacity : Count_Type := 1000) return Map;
+
No_Element : constant Cursor;
-- Cursor objects declared without an initialization expression are
-- initialized to the value No_Element.
return Position.Node.Element.all;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 1000) return Set is
+ begin
+ return Result : Set do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
---------------------
-- Equivalent_Sets --
---------------------
with Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_Set,
+ Aggregate => (Empty => Empty,
Add_Unnamed => Include);
pragma Preelaborable_Initialization (Set);
-- Set objects declared without an initialization expression are
-- initialized to the value Empty_Set.
+ function Empty (Capacity : Count_Type := 1000) return Set;
+
No_Element : constant Cursor;
-- Cursor objects declared without an initialization expression are
-- initialized to the value No_Element.
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_Map,
+ Aggregate => (Empty => Empty,
Add_Named => Insert);
pragma Preelaborable_Initialization (Map);
Empty_Map : constant Map;
+ function Empty return Map;
+
No_Element : constant Cursor;
function Has_Element (Position : Cursor) return Boolean;
-- Returns a pointer to the element designated by Position.
Empty_Map : constant Map := (Controlled with others => <>);
+ function Empty return Map is (Empty_Map);
No_Element : constant Cursor := Cursor'(null, null);
Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_Set,
+ Aggregate => (Empty => Empty,
Add_Unnamed => Include);
pragma Preelaborable_Initialization (Set);
pragma Preelaborable_Initialization (Cursor);
Empty_Set : constant Set;
+ function Empty return Set;
No_Element : constant Cursor;
-- Returns a pointer to the element designated by Position.
Empty_Set : constant Set := (Controlled with others => <>);
+ function Empty return Set is (Empty_Set);
No_Element : constant Cursor := Cursor'(null, null);
end if;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 10) return Vector is
+ begin
+ return Result : Vector (Capacity) do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
--------------
-- Finalize --
--------------
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_Vector,
+ Aggregate => (Empty => Empty,
Add_Unnamed => Append_One,
New_Indexed => New_Vector,
Assign_Indexed => Replace_Element);
package Vector_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor, Has_Element);
+ function Empty (Capacity : Count_Type := 10) return Vector;
+
overriding function "=" (Left, Right : Vector) return Boolean;
function New_Vector (First, Last : Index_Type) return Vector
return Position.Node.Element;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 1000) return Map is
+ begin
+ return Result : Map do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
-------------------------
-- Equivalent_Key_Node --
-------------------------
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_Map,
+ Aggregate => (Empty => Empty,
Add_Named => Insert);
pragma Preelaborable_Initialization (Map);
-- Cursor objects declared without an initialization expression are
-- initialized to the value No_Element.
+ function Empty (Capacity : Count_Type := 1000) return Map;
+
function Has_Element (Position : Cursor) return Boolean;
-- Returns True if Position designates an element, and returns False
-- otherwise.
return Position.Node.Element;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 1000) return Set is
+ begin
+ return Result : Set do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
---------------------
-- Equivalent_Sets --
---------------------
Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_Set,
+ Aggregate => (Empty => Empty,
Add_Unnamed => Include);
pragma Preelaborable_Initialization (Set);
package Set_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor, Has_Element);
+ function Empty (Capacity : Count_Type := 1000) return Set;
+
function "=" (Left, Right : Set) return Boolean;
-- For each element in Left, set equality attempts to find the equal
-- element in Right; if a search fails, then set equality immediately
end;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 10) return Vector is
+ begin
+ return Result : Vector do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
--------------
-- Finalize --
--------------
No_Element : constant Cursor;
+ function Empty (Capacity : Count_Type := 10) return Vector;
+
function Has_Element (Position : Cursor) return Boolean;
package Vector_Iterator_Interfaces is new
return Position.Container.Elements.EA (Position.Index);
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 10) return Vector is
+ begin
+ return Result : Vector do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
--------------
-- Finalize --
--------------
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_Vector,
+ Aggregate => (Empty => Empty,
Add_Unnamed => Append_One,
New_Indexed => New_Vector,
Assign_Indexed => Replace_Element);
Empty_Vector : constant Vector;
-- Empty_Vector represents the empty vector object. It has a length of 0.
+ function Empty (Capacity : Count_Type := 10) return Vector;
+
overriding function "=" (Left, Right : Vector) return Boolean;
-- If Left and Right denote the same vector object, then the function
-- returns True. If Left and Right have different lengths, then the
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type,
- Aggregate => (Empty => Empty_Map,
+ Aggregate => (Empty => Empty,
Add_Named => Insert);
type Cursor is private;
pragma Preelaborable_Initialization (Cursor);
Empty_Map : constant Map;
+ function Empty return Map;
No_Element : constant Cursor;
-- Returns a pointer to the element designated by Position.
Empty_Map : constant Map := (Controlled with others => <>);
+ function Empty return Map is (Empty_Map);
No_Element : constant Cursor := Cursor'(null, null);
with Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type;
- -- Aggregate => (Empty => Empty_Set,
+ -- Aggregate => (Empty => Empty,
-- Add_Unnamed => Include);
pragma Preelaborable_Initialization (Set);
function Has_Element (Position : Cursor) return Boolean;
Empty_Set : constant Set;
+ function Empty return Set;
No_Element : constant Cursor;
-- Returns a pointer to the element designated by Position.
Empty_Set : constant Set := (Controlled with others => <>);
+ function Empty return Set is (Empty_Set);
No_Element : constant Cursor := Cursor'(null, null);
elsif Is_Array_Type (Typ) and then Null_Record_Present (N) then
Error_Msg_N ("null record forbidden in array aggregate", N);
+ elsif Present (Find_Aspect (Typ, Aspect_Aggregate))
+ and then Ekind (Typ) /= E_Record_Type
+ then
+ Resolve_Container_Aggregate (N, Typ);
+
elsif Is_Record_Type (Typ) then
Resolve_Record_Aggregate (N, Typ);
elsif T2 = Any_Composite and then Is_Aggregate_Type (T1) then
return True;
+ -- In Ada_2020, an aggregate is compatible with the type that
+ -- as the ccorrespoding aspect.
+
+ elsif Ada_Version >= Ada_2020
+ and then T2 = Any_Composite
+ and then Present (Find_Aspect (T1, Aspect_Aggregate))
+ then
+ return True;
+
-- If the expected type is an anonymous access, the designated type must
-- cover that of the expression. Use the base type for this check: even
-- though access subtypes are rare in sources, they are generated for
or else NT (N).Nkind = N_Formal_Concrete_Subprogram_Declaration
or else NT (N).Nkind = N_Formal_Package_Declaration
or else NT (N).Nkind = N_Generic_Association
- or else NT (N).Nkind = N_Iterated_Component_Association);
+ or else NT (N).Nkind = N_Iterated_Component_Association
+ or else NT (N).Nkind = N_Iterated_Element_Association);
return Flag15 (N);
end Box_Present;
or else NT (N).Nkind = N_Formal_Concrete_Subprogram_Declaration
or else NT (N).Nkind = N_Formal_Package_Declaration
or else NT (N).Nkind = N_Generic_Association
- or else NT (N).Nkind = N_Iterated_Component_Association);
+ or else NT (N).Nkind = N_Iterated_Component_Association
+ or else NT (N).Nkind = N_Iterated_Element_Association);
Set_Flag15 (N, Val);
end Set_Box_Present;
-- Expression (Node3)
-- Loop_Parameter_Specification (Node4)
-- Loop_Actions (List5-Sem)
+ -- Box_Present (Flag15)
-- Exactly one of Iterator_Specification or Loop_Parameter_
-- specification is present. If the Key_Expression is absent,