Func : Entity_Id;
First_Op : Entity_Id;
Cursor : Entity_Id;
+ Specific_Type : Entity_Id := Typ;
begin
-- If error already detected, return
return Any_Type;
end if;
+ if Is_Class_Wide_Type (Specific_Type) then
+ Specific_Type := Etype (Typ);
+ end if;
+
-- The cursor type for an Iterable aspect is the return type of a
-- non-overloaded First primitive operation. Locate association for
-- First.
-- is created for it, check that the base type of the first formal
-- of First matches the base type of the domain.
- Func := First_Entity (Scope (Typ));
+ Func := First_Entity (Scope (Specific_Type));
while Present (Func) loop
if Chars (Func) = Chars (First_Op)
and then Ekind (Func) = E_Function
and then Present (First_Formal (Func))
- and then Base_Type (Etype (First_Formal (Func))) = Base_Type (Typ)
+ and then Base_Type (Etype (First_Formal (Func)))
+ = Base_Type (Specific_Type)
and then No (Next_Formal (First_Formal (Func)))
then
if Cursor /= Any_Type then