procedure Push_Scope_And_Install_Discriminants (E : Entity_Id) is
begin
- if Has_Discriminants (E) then
+ if Is_Type (E) and then Has_Discriminants (E) then
Push_Scope (E);
-- Make the discriminants visible for type declarations and protected
procedure Uninstall_Discriminants_And_Pop_Scope (E : Entity_Id) is
begin
- if Has_Discriminants (E) then
+ if Is_Type (E) and then Has_Discriminants (E) then
Uninstall_Discriminants (E);
Pop_Scope;
end if;