--
-- This is a test of semantic checking for test 21.
--
package test22 is body
    i : integer;
    type complex is record r, i : float; end record;
    type pair is record first, second : complex; end record;
    c : complex;
    p : pair;
    pair : pair;  -- 'pair' cannot be both a variable and a type
    procedure print() is begin
	write("    (", c.r, ", ", c.i, ")");
    end;
begin 
    c.r := 0.0;
    c.i := 0.0;
    p.first := c.r;  -- incompatible assignment
    c.r := 1.0;
    c.i := 1.0;
    p.second := c;
    c := p.first;
    write ("The first complex number should be (0.0, 0.0):");
    print();
    c := p.second;
    write ("The second complex number should be (1.0, 1.0):");
    print();
    if p.first <> second then  -- 'second' is an undeclared variable
	write ("And these two complex numbers are not equal!");
    else
	write ("And these two complex numbers ARE equal?");
    end if;
end.
