{: test assignment bounds errors
   these errors should be discoverable at compile time }
program e202(output);

const n = 5;
type
  bType  = -n..+n;
  count  =  (one, two, three, four, five, six, seven, eight, nine, ten);
var
   a1    : bType;
   a2    : two..nine;
   a3    : five..five;
   pass1 : boolean;
   i,j   : integer;

procedure p( aa : bType );
begin
   aa := -n;
   aa := -n-1;
   write('error not detected');
end; { p }

begin
   pass1 := true;

   { should give compile time errors }
   a1 := -5;    {OK}
   a1 := -6;    {!!! error}
   a1 := -n-1;  {!!! error}
   a1 := -2*3;  {!!! error}

   a1 := 5;    {OK}
   a1 := 6;    {!!! error}
   a1 := n+1;  {!!! error}
   a1 := 2*3;  {!!! error}

   j := -5;
   a1 := j;     {OK}
   a1 := j-1;   {not detectable at compile time}

   j := 5;
   a1 := j;     {OK}
   a1 := j+1;   {not detectable at compile time}


   a2 := two;    {OK}
   a2 := one;    {!!! error}

   a2 := nine;    {OK}
   a2 := ten;     {!!! error}
   a2 := 10;      {!!! error}

   a3 := five;    {OK}
   a3 := four;    {!!! error}
   a3 := six;     {!!! error}


end. { e202 }
