--  Names and visibility (RM 4.1.3, 8.1, 8.6): a grandparent's declarations in a grandchild;
--  a package's own name in its body; an expanded name through a block's name past a nearer
--  declaration; a declared operator of the context's type preferred to the universal one.
with Ada.Text_IO;
with Os.Files;
with Os;
procedure Main is
   package P is
      type T is range -100 .. 100;
      function "+" (X : T) return T;
   end P;
   use P;
   package body P is
      function "+" (X : T) return T is (if X < 100 then X + 1 else X);
   end P;
   type QT is new T;
   X : constant QT := +0;
begin
   Os.Files.Bump;
   One : declare
      A : Integer := 2;
   begin
      declare
         A : constant Integer := 3;
      begin
         Ada.Text_IO.Put_Line (Integer'Image (A) & Integer'Image (One.A) & Integer'Image (Os.Counter) & QT'Image (X));
      end;
      One.A := 4;
      Ada.Text_IO.Put_Line (Integer'Image (A));
   end One;
end Main;
