raz / test / run / ConstOfConst.raz

20 lines · 591 B · raw · history · last change 264716cb

1(* A named record or array constant as an element of an array constant,
2 and a constant with an address in it. *)
3module ConstOfConst;
4import Sys;
5
6type R = record a: INT; s: []const U8; end;
7
8const X: R = {a: 1, s: "one"};
9const Row: [2]INT = [3, 4];
10const Y: [2]R = [X, {a: 2, s: "two"}];
11const Grid: [2][2]INT = [Row, [5, 6]];
12
13proc main*;
14begin
15 _ := Sys.write(Sys.stdout, Y[0].s);
16 _ := Sys.write(Sys.stdout, Y[1].s);
17 _ := Sys.write(Sys.stdout, "\n");
18 if (Y[0].a # 1) or (Y[1].a # 2) or (Grid[0][1] # 4) or (Grid[1][0] # 5) then Sys.exit(1); end;
19end;
20end ConstOfConst.