Discr := First (Discriminant_Specifications (N));
while Present (Discr) loop
+ if Ekind (Defining_Identifier (Discr)) = E_In_Parameter then
+ Reinit_Field_To_Zero
+ (Defining_Identifier (Discr), F_Discriminal_Link);
+ end if;
+
+ Mutate_Ekind (Defining_Identifier (Discr), E_Discriminant);
Enter_Name (Defining_Identifier (Discr));
-- For navigation purposes we add a reference to the discriminant
while Present (Discr) loop
Id := Defining_Identifier (Discr);
- if Ekind (Id) = E_In_Parameter then
- Reinit_Field_To_Zero (Id, F_Discriminal_Link);
- end if;
-
- Mutate_Ekind (Id, E_Discriminant);
Set_Is_Not_Self_Hidden (Id);
Reinit_Component_Location (Id);
Reinit_Esize (Id);
-- but the error should be posted on it, not on the component.
elsif Ekind (E) = E_Discriminant
+ and then Is_Not_Self_Hidden (E)
and then Present (Scope (Def_Id))
and then Scope (Def_Id) /= Current_Scope
then
-- Avoid cascaded messages with duplicate components in
-- derived types.
- if Ekind (E) in E_Component | E_Discriminant then
+ if Ekind (E) = E_Component
+ or else (Ekind (E) = E_Discriminant
+ and then Is_Not_Self_Hidden (E))
+ then
return;
end if;
end if;