raz / commit 6089fb3b

commit
6089fb3ba15c23b4964d5f9b2c006a165a591ea0
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
b1a880ea
Record constants, constant tables, and Str.copy

Report 2026-10.16. AggregateConst reads an array or record constant
part by part (ConstPart) into a rodata chunk: numbers, sets and the
like as before, a string into a []U8 or a [n]U8, an array constant
into a slice, procedures, ERRORs and nil. An address in it is a data
fixup (chunk.pas's AddDataFixup), a 64-bit field the linker fills with
the chunk's address; MarkLive follows them. MakeItem makes a record
constant a read-only variable, as an array constant is. Str.copy
copies a slice into memory from an allocator. conform/run/RecordConst;
conform/err/ArrayConstElem now refuses a variant. 7,891 lines of code.

patch · log

14 files changed, +229 -68

CLAUDE.md modified +4 -3

@@ -86,12 +86,13 @@
8686 defect, and the library grows only by what breaks no program written
8787 for it. A wish for more, the owner's or yours, goes on the list in
8888 `PLAN.md`, for a later thaw; it isn't built. v0.6.0 was such a thaw,
89-by the owner's word: report 2026-10.12; the compiler follows 2026-10.15,
89+by the owner's word: report 2026-10.12; the compiler follows 2026-10.16,
9090 whose `Sys` writes without waiting, for rat's pastes (10.13), and
9191 whose blank, `_ := f(x)`, drops a result that is otherwise warned of
9292 (10.14), and whose `Math` has `pow`, the logarithms to 2 and 10,
93-rounding and the inverse functions, and `Sys` `space` (10.15), also
94-by the owner's word. Its parser
93+rounding and the inverse functions, and `Sys` `space` (10.15), and
94+whose constants may be records and tables of them, with `Str.copy`
95+(10.16), also by the owner's word. Its parser
9596 reaches the machine only through `gen.pas`; its steps 5 to 10 await
9697 the owner's review, and git has them. Keep
9798 `doc/compiler.md`'s table of lines and its routine names true when the

conform/err/ArrayConstElem.raz (history) modified +2 -2

@@ -1,4 +1,4 @@
11 module ArrayConstElem;
2-type R = record a: I64; end;
3-const P: [1]R = [{a: 1}];
2+type S = variant a; b; end;
3+const P: [1]S = [a];
44 end ArrayConstElem.

conform/run/RecordConst.expect (history) added +9 -0

@@ -0,0 +1,9 @@
1+firefox 2
2+mpv 0 float
3+ 0
4+30
5+home7
6+3
7+bye113
8+hello 5
9+nil run

conform/run/RecordConst.raz (history) added +34 -0

@@ -0,0 +1,34 @@
1+module RecordConst;
2+import Out;
3+type
4+ Act = (quit, focus, spawn);
5+ Rule = record cls: []U8; tag: INT; float: BOOL; end;
6+ Key = record mods: U8; sym: U32; act: Act; arg: [8]U8; run: proc(n: INT); end;
7+const
8+ Rules: [3]Rule = [{cls: "firefox", tag: 2}, {cls: "mpv", float: true}, {}];
9+ Nums: [3]I64 = [10, 20, 30];
10+ Lists: [2][]I64 = [Nums, Nums];
11+ Home: Rule = {cls: "home", tag: 7};
12+ Grid: [2][2]U8 = [[1, 2], [3, 4]];
13+proc hello(n: INT);
14+begin
15+ Out.str("hello "); Out.int(n); Out.ln;
16+end;
17+const Keys: [2]Key = [{mods: 4, sym: 113, act: quit, arg: "bye", run: hello}, {act: spawn, run: nil}];
18+proc main*;
19+var i: INT; r: Rule;
20+begin
21+ for i := 0 to LEN(Rules) - 1 do
22+ Out.str(Rules[i].cls); Out.str(" "); Out.int(Rules[i].tag); Out.str(" ");
23+ if Rules[i].float then Out.str("float"); end;
24+ Out.ln;
25+ end;
26+ Out.int(Lists[1][2]); Out.ln;
27+ r := Home;
28+ Out.str(r.cls); Out.int(Home.tag); Out.ln;
29+ Out.int(I64(Grid[1][0])); Out.ln;
30+ Out.str(Keys[0].arg[0..3]); Out.int(INT(Keys[0].sym)); Out.ln;
31+ Keys[0].run(5);
32+ if Keys[1].run = nil then Out.str("nil run"); Out.ln; end;
33+end;
34+end RecordConst.

doc/compiler.md (history) modified +15 -9

@@ -11,12 +11,12 @@
1111 | `src/diag.pas` | 310 | 229 | Messages: positions, source excerpts, colour, counts |
1212 | `src/scan.pas` | 886 | 747 | Symbols, literals, comments, positions |
1313 | `src/sym.pas` | 615 | 510 | Types, objects, scopes, layout |
14-| `src/chunk.pas` | 276 | 217 | The compiled program: chunks, fixups, line notes |
14+| `src/chunk.pas` | 298 | 232 | The compiled program: chunks, fixups, line notes |
1515 | `src/x64.pas` | 1,039 | 870 | The instruction encoder, jumps within a procedure, the assembler |
1616 | `src/gen.pas` | 1,332 | 1,039 | The stack machine, for x86-64: values, operations, checks, calls, frames |
1717 | `src/item.pas` | 1,342 | 1,118 | Items: types, constants, variables, operators, conversions, calls |
18-| `src/parse.pas` | 2,712 | 2,407 | Declarations, statements, expressions, built-ins, recovery, warnings |
19-| `src/link.pas` | 234 | 180 | Tree shaking, layout, patching, the places |
18+| `src/parse.pas` | 2,771 | 2,459 | Declarations, statements, expressions, built-ins, recovery, warnings |
19+| `src/link.pas` | 243 | 188 | Tree shaking, layout, patching, the places |
2020 | `src/elf.pas` | 435 | 352 | Static and dynamic ELF, symbol table, line numbers |
2121 | `src/raz.pas` | 197 | 147 | The command line |
2222
@@ -219,7 +219,10 @@
219219
220220 A *fixup* (`TFixup`) is a 32-bit field in the code that will hold the
221221 distance to another chunk: a call's target, or a rip-relative address.
222-`AddFixup` records one; `link.pas` fills them in. `NoteLine` records
222+`AddFixup` records one; `link.pas` fills them in. A constant's
223+addresses are *data fixups*, `AddDataFixup`'s: 64-bit fields in
224+rodata that will hold a chunk's address itself, since the executable is
225+loaded where the linker placed it. `NoteLine` records
223226 which line and column of the source the code from `pc` on belongs to,
224227 for gdb and for the places. `ExternChunk` makes, once per C symbol,
225228 the quadword the dynamic loader will fill with that symbol's address.
@@ -380,9 +383,11 @@
380383 variable into an item for part of it, mostly by adding to `off`. An
381384 item for another module's exported variable, or part of it, is `ro`:
382385 it isn't a variable (`isVar`), and `NotReadOnly` says why where one is
383-wanted; what it points at is. An array constant is a variable too, in
384-read-only data: `ArrayConst` (`parse.pas`) reads its literal into the
385-bytes of a chunk, as a string constant's are, and `MakeItem` makes it
386+wanted; what it points at is. An array or record constant is a
387+variable too, in read-only data: `AggregateConst` (`parse.pas`) reads
388+its literal, part by part in `ConstPart`, into the bytes of a chunk,
389+as a string constant's are; an address in it, of a string, an array
390+constant, a procedure or an `ERROR`, becomes a data fixup. `MakeItem` makes it
386391 an `mVar` there that isn't `isVar`, so it is read, indexed, sliced and
387392 passed, never changed. `Index` and `Slice` have gen make the bounds
388393 checks, unless the module says `check off;` (`checks`, which
@@ -505,11 +510,12 @@
505510 ## link.pas: tree shaking and layout
506511
507512 `MarkLive` starts from the entry chunk and follows fixups, marking each
508-chunk it reaches; nothing else goes into the executable. `LinkAll`
513+chunk it reaches, through the data fixups of constants too; nothing
514+else goes into the executable. `LinkAll`
509515 places the live chunks section by section (`Place`), each at its
510516 alignment, then copies their bytes into the images of text and rodata,
511517 patching every fixup with the distance from the end of its field to its
512-target.
518+target, and every data fixup with its target's address.
513519
514520 Between placing text and placing rodata, `MakePlaces` writes the
515521 places, a rodata chunk: for each line note in live code, its address,

lib/Str.raz (history) modified +19 -2

@@ -1,11 +1,23 @@
11 (* Operations on strings, which are []U8. = and # compare them; this
22 module orders, searches and hashes them, reads and writes their
3- UTF-8, and reads a number from one. *)
3+ UTF-8, reads a number from one, and copies one to keep. *)
44 module Str;
5-import Rt;
5+import Mem, Heap, Rt;
66
77 const least = -9223372036854775807 - 1; (* the smallest I64 *)
88
9+(* s's bytes, copied into memory from a, to keep after s's own are
10+ gone; "" and false if a has no room. *)
11+proc copy*(a: ^Mem.Allocator; s: []U8): ([]U8, BOOL);
12+var p: ^U8; i: INT;
13+begin
14+ if LEN(s) = 0 then return "", true; end;
15+ p := Mem.alloc(a, LEN(s), 1);
16+ if p = nil then return "", false; end;
17+ for i := 0 to LEN(s) - 1 do p[i] := s[i]; end;
18+ return p[0..LEN(s)], true;
19+end;
20+
921 (* -1, 0 or 1 as a sorts before, with or after b, byte by byte. *)
1022 proc cmp*(a, b: []U8): INT;
1123 var i, n: INT;
@@ -258,7 +270,12 @@
258270
259271 (* The module's test: stops the program if something is wrong. *)
260272 proc main*;
273+var buf: [3]U8; t: []U8; ok: BOOL;
261274 begin
275+ buf := "abc";
276+ t, ok := copy(Heap.heap, buf);
277+ buf[0] := 'x';
278+ if not ok or (t # "abc") then Rt.stop("Str.copy"); end;
262279 if (cmp("a", "b") # -1) or (cmp("b", "a") # 1) or (cmp("ab", "ab") # 0)
263280 or (cmp("a", "ab") # -1) or (cmp("", "") # 0) then Rt.stop("Str.cmp"); end;
264281 if not eq("x", "x") or eq("x", "y") then Rt.stop("Str.eq"); end;

src/chunk.pas modified +24 -2

@@ -28,7 +28,7 @@
2828 TChunk = record
2929 sec: TSection;
3030 start, size, align: longint; { in its section's buffer }
31- firstFix, numFix: longint; { its fixups, text chunks only }
31+ firstFix, numFix: longint; { its fixups: text's in fixups, rodata's in dataFixups }
3232 module, name: longint; { for the symbol table; -1 if none }
3333 adr: int64; { its address, set by the linker }
3434 live: boolean; { reached from the entry point }
@@ -53,7 +53,8 @@
5353 end;
5454
5555 TFixup = record
56- at: longint; { the 32-bit field, as an offset in text }
56+ at: longint; { the 32-bit field, as an offset in text; in
57+ dataFixups, the 64-bit one, from its chunk's start }
5758 chunk: longint; { the chunk it refers to }
5859 addend: longint; { added to the chunk's address }
5960 end;
@@ -74,6 +75,11 @@
7475 numChunks: longint;
7576 fixups: PFixups;
7677 numFixups: longint;
78+ { Addresses in read-only data, as in an array constant of strings:
79+ each 8 bytes, the chunk's absolute address, since the executable
80+ is loaded where the linker placed it }
81+ dataFixups: PFixups;
82+ numDataFixups: longint;
7783 lines: PLines;
7884 numLines: longint;
7985 curFile: longint; { the file being compiled, for NoteLine }
@@ -89,6 +95,7 @@
8995 function ExternChunk(name: longint): longint;
9096 procedure NoteLine(line, col: longint);
9197 procedure AddFixup(at, chunk, addend: longint);
98+procedure AddDataFixup(c, at, chunk, addend: longint);
9299 procedure NoteVar(chunk, name, off, kind: longint);
93100 function ChunkName(c: longint): shortstring;
94101
@@ -181,6 +188,8 @@
181188 rodata := ReAllocMem(rodata, roCap);
182189 end;
183190 Move(p^, rodata^[rolen], n);
191+ chunks^[c].firstFix := numDataFixups;
192+ chunks^[c].numFix := 0;
184193 chunks^[c].start := rolen;
185194 chunks^[c].size := n;
186195 chunks^[c].align := align;
@@ -235,6 +244,19 @@
235244 fixups^[numFixups].chunk := chunk;
236245 fixups^[numFixups].addend := addend;
237246 inc(numFixups);
247+end;
248+
249+{ The address of chunk, plus addend, at offset at of rodata chunk c,
250+ whose data is set: its fixups follow one another. }
251+procedure AddDataFixup(c, at, chunk, addend: longint);
252+begin
253+ if numDataFixups and 255 = 0 then
254+ dataFixups := ReAllocMem(dataFixups, (numDataFixups + 256) * SizeOf(TFixup));
255+ dataFixups^[numDataFixups].at := at;
256+ dataFixups^[numDataFixups].chunk := chunk;
257+ dataFixups^[numDataFixups].addend := addend;
258+ inc(numDataFixups);
259+ inc(chunks^[c].numFix);
238260 end;
239261
240262 procedure NoteVar(chunk, name, off, kind: longint);

src/item.pas modified +2 -2

@@ -230,8 +230,8 @@
230230 oConst:
231231 if o^.typ = tStr then begin
232232 x.mode := mStr; x.val := o^.val; x.chunk := o^.chunk
233- end else if o^.typ^.form = fArray then begin
234- { an array constant: a variable in read-only data, not one of
233+ end else if o^.typ^.form in [fArray, fRecord] then begin
234+ { an array or record constant: a variable in read-only data, not one of
235235 the program's, so nothing can change it }
236236 x.mode := mVar; x.base := bGlobal; x.chunk := o^.chunk
237237 end else begin

src/link.pas modified +16 -7

@@ -42,7 +42,7 @@
4242
4343 { Marks live each chunk reached from entry through the fixups. }
4444 procedure MarkLive(entry: longint);
45-var stack: PLongs; sp, c, f, t: longint;
45+var stack: PLongs; sp, c, f, t: longint; fx: PFixups;
4646 begin
4747 stack := GetMem(numChunks * 4);
4848 sp := 0;
@@ -53,10 +53,15 @@
5353 dec(sp);
5454 c := stack^[sp];
5555 if chunks^[c].size < 0 then Fatal(ChunkName(c) + ' is declared but never defined');
56- { only code has fixups: data holds no addresses, so it uses nothing }
57- if chunks^[c].sec <> secText then continue;
56+ { code and constants have fixups; variables start at zero, holding
57+ no addresses }
58+ case chunks^[c].sec of
59+ secText: fx := fixups;
60+ secRodata: fx := dataFixups;
61+ else continue;
62+ end;
5863 for f := chunks^[c].firstFix to chunks^[c].firstFix + chunks^[c].numFix - 1 do begin
59- t := fixups^[f].chunk;
64+ t := fx^[f].chunk;
6065 if not chunks^[t].live then begin
6166 chunks^[t].live := true;
6267 stack^[sp] := t;
@@ -225,9 +230,13 @@
225230 PLongint(@textImg^[p + at])^ := longint(v);
226231 end;
227232 end;
228- secRodata:
229- Move(rodata^[chunks^[c].start], roImg^[chunks^[c].adr - (Base + roOff)],
230- chunks^[c].size);
233+ secRodata: begin
234+ p := chunks^[c].adr - (Base + roOff);
235+ Move(rodata^[chunks^[c].start], roImg^[p], chunks^[c].size);
236+ for f := chunks^[c].firstFix to chunks^[c].firstFix + chunks^[c].numFix - 1 do
237+ PInt64(@roImg^[p + dataFixups^[f].at])^ :=
238+ chunks^[dataFixups^[f].chunk].adr + dataFixups^[f].addend;
239+ end;
231240 end;
232241 end;
233242

src/parse.pas modified +94 -35

@@ -1918,39 +1918,100 @@
19181918 Declare(o);
19191919 end;
19201920
1921-{ The value of n, an array constant of type t: an array literal of
1922- constants, which become the bytes of a read-only chunk, as a string
1923- constant's do (report section 4). The bytes are the compiler's own
1921+{ An array or record constant: a literal of constants, which become
1922+ the bytes of a read-only chunk, as a string constant's do (report
1923+ section 4). An address in it, of a string, an array constant, a
1924+ procedure or an ERROR, waits in fixes until the chunk is made, then
1925+ is a fixup the linker patches. The bytes are the compiler's own
19241926 machine's, little-endian, as the target's are. }
1925-function ArrayConst(t: PType; n: longint): longint;
1926-var et: PType; e: TItem; p: PBytes; k, es: int64; f: single; c: longint; start: TPos;
1927+var
1928+ constBytes: PBytes;
1929+ fixes: array[0..4095] of record off: int64; chunk: longint; end;
1930+ numFixes: longint;
1931+
1932+procedure ConstFix(off: int64; chunk: longint);
1933+begin
1934+ if numFixes > High(fixes) then MarkAt(TokPos, 'more than ' + IntStr(High(fixes) + 1) + ' addresses in one constant');
1935+ fixes[numFixes].off := off;
1936+ fixes[numFixes].chunk := chunk;
1937+ inc(numFixes);
1938+end;
1939+
1940+{ The part of type t at offset off of the constant }
1941+procedure ConstPart(t: PType; off: int64);
1942+var e: TItem; f: PObj; k: int64; r: single; start: TPos;
19271943 begin
1928- et := t^.base;
1929- es := et^.size;
19301944 start := TokPos;
1931- if tok <> sLbrak then Expected('an array literal');
1932- Next;
1933- p := nil; k := 0;
1934- if tok <> sRbrak then
1935- repeat
1936- Expression(e, et);
1937- Coerce(e, et);
1938- if e.mode <> mConst then MarkAt(e.pos, 'expected a constant, found ' + What(e));
1939- ReAllocMem(p, (k + 1) * es);
1940- if (et^.form = fReal) and (es = 4) then begin
1941- f := RealOf(e);
1942- Move(f, p^[k * es], 4);
1943- end else Move(e.val, p^[k * es], es);
1944- inc(k);
1945- if tok <> sComma then break;
1946- Next;
1947- until false;
1948- Expect(sRbrak);
1949- if k <> t^.len then MarkAt(SpanFrom(start), 'expected ' + IntStr(t^.len) + ' elements, found ' + IntStr(k));
1945+ if (t^.form = fArray) and (tok = sLbrak) then begin
1946+ Next;
1947+ k := 0;
1948+ if tok <> sRbrak then
1949+ repeat
1950+ if k < t^.len then ConstPart(t^.base, off + k * t^.base^.size)
1951+ else ConstPart(t^.base, off);
1952+ inc(k);
1953+ if tok <> sComma then break;
1954+ Next;
1955+ until false;
1956+ Expect(sRbrak);
1957+ if k <> t^.len then MarkAt(SpanFrom(start), 'expected ' + IntStr(t^.len) + ' elements, found ' + IntStr(k));
1958+ exit;
1959+ end;
1960+ if (t^.form = fRecord) and not t^.tuple and (tok = sLbrace) then begin
1961+ Next;
1962+ if tok <> sRbrace then
1963+ repeat
1964+ if tok <> sIdent then Expected('a field');
1965+ f := FieldOf(t);
1966+ Next;
1967+ Expect(sColon);
1968+ ConstPart(f^.typ, off + f^.val);
1969+ if tok <> sComma then break;
1970+ Next;
1971+ until false;
1972+ Expect(sRbrace);
1973+ exit;
1974+ end;
1975+ Expression(e, t);
1976+ if (e.mode = mStr) and ((t^.form = fSlice) or (t^.form = fArray)) and (t^.base = tU8) then begin
1977+ if t^.form = fSlice then begin
1978+ ConstFix(off, e.chunk);
1979+ Move(e.val, constBytes^[off + 8], 8);
1980+ end else if e.val > t^.len then MarkAt(e.pos, 'the string is longer than ' + TypeName(t))
1981+ else Move(rodata^[chunks^[e.chunk].start], constBytes^[off], e.val);
1982+ end else if t^.form = fSlice then begin
1983+ if (e.mode <> mVar) or (e.obj = nil) or (e.obj^.cls <> oConst) or (e.typ^.form <> fArray)
1984+ or (e.pos.b - e.pos.a <> length(NameOf(e.obj^.name))) or not Same(e.typ^.base, t^.base) then
1985+ MarkAt(e.pos, 'a constant slice is a string or an array constant of its elements, found ' + What(e));
1986+ ConstFix(off, e.chunk);
1987+ Move(e.typ^.len, constBytes^[off + 8], 8);
1988+ end else if t^.form = fVariant then MarkAt(e.pos, 'a constant holds no variant')
1989+ else if t^.form in [fArray, fRecord] then MarkAt(e.pos, 'expected a literal of ' + TypeName(t))
1990+ else begin
1991+ Coerce(e, t);
1992+ if (e.mode = mProc) and not e.obj^.ext then ConstFix(off, e.obj^.chunk)
1993+ else if e.mode <> mConst then MarkAt(e.pos, 'expected a constant, found ' + What(e))
1994+ else if (t^.form = fError) and (e.val > 0) then ConstFix(off, e.val - 1)
1995+ else if (t^.form = fPtr) and (e.val <> 0) then MarkAt(e.pos, 'a constant pointer is nil')
1996+ else if (t^.form = fReal) and (t^.size = 4) then begin
1997+ r := RealOf(e);
1998+ Move(r, constBytes^[off], 4);
1999+ end else Move(e.val, constBytes^[off], t^.size);
2000+ end;
2001+end;
2002+
2003+{ The chunk of n, a constant of type t whose literal is next }
2004+function AggregateConst(t: PType; n: longint): longint;
2005+var c, i: longint;
2006+begin
2007+ constBytes := AllocMem(t^.size + 8);
2008+ numFixes := 0;
2009+ ConstPart(t, 0);
19502010 c := NewChunk(secRodata, curModule^.sname, n);
1951- SetData(c, p, t^.size, t^.align);
1952- FreeMem(p);
1953- ArrayConst := c;
2011+ SetData(c, constBytes, t^.size, t^.align);
2012+ for i := 0 to numFixes - 1 do AddDataFixup(c, fixes[i].off, fixes[i].chunk, 0);
2013+ FreeMem(constBytes);
2014+ AggregateConst := c;
19542015 end;
19552016
19562017 procedure ConstDecl(top: boolean);
@@ -1963,15 +2024,13 @@
19632024 Next;
19642025 start := TokPos;
19652026 t := ParseType;
1966- if (t^.form = fArray) and not (t^.base^.form in [fInt, fReal, fBool, fEnum, fSet]) then
1967- MarkAt(SpanFrom(start), 'an array constant holds integers, reals, BOOLs, enumerations or sets, found ' + TypeName(t^.base))
1968- else if (t <> tError) and (t^.form <> fArray) then
1969- MarkAt(SpanFrom(start), 'only an ERROR or an array constant has a type');
2027+ if (t <> tError) and not ((t^.form = fArray) or (t^.form = fRecord) and not t^.tuple) then
2028+ MarkAt(SpanFrom(start), 'only an ERROR, an array or a record constant has a type');
19702029 end;
19712030 Expect(sEql);
1972- if (t <> nil) and (t^.form = fArray) then begin
2031+ if (t <> nil) and (t^.form in [fArray, fRecord]) then begin
19732032 o := NewObj(oConst, n, t);
1974- o^.chunk := ArrayConst(t, n);
2033+ o^.chunk := AggregateConst(t, n);
19752034 o^.pos := at;
19762035 o^.exported := exp and top;
19772036 Declare(o);

src/raz.pas modified +1 -1

@@ -34,7 +34,7 @@
3434 { what git describe says, made by make: 0.3.0 at the tag v0.3.0,
3535 0.3.0-5-g38d29a8 five commits past it }
3636 Version = {$I version.inc};
37- Report = '2026-10.15'; { the version of doc/raz.md it follows }
37+ Report = '2026-10.16'; { the version of doc/raz.md it follows }
3838 MemfdCreate = 319; { the system call; FPC 3.2.2 has no name for it }
3939 MfdCloexec = 1; { an ELF still executes: the kernel opens it first }
4040

test/doc/Str.expect (history) modified +5 -1

@@ -1,7 +1,11 @@
11 module Str;
22 Operations on strings, which are []U8. = and # compare them; this
33 module orders, searches and hashes them, reads and writes their
4- UTF-8, and reads a number from one.
4+ UTF-8, reads a number from one, and copies one to keep.
5+
6+proc copy*(a: ^Mem.Allocator; s: []U8): ([]U8, BOOL);
7+ s's bytes, copied into memory from a, to keep after s's own are
8+ gone; "" and false if a has no room.
59
610 proc cmp*(a, b: []U8): INT;
711 -1, 0 or 1 as a sorts before, with or after b, byte by byte.

test/msg/ArrayConstElem.err (history) modified +3 -3

@@ -1,4 +1,4 @@
1-conform/err/ArrayConstElem.raz:3:10: error: an array constant holds integers, reals, BOOLs, enumerations or sets, found R
2- 3 | const P: [1]R = [{a: 1}];
3- | ^^^^
1+conform/err/ArrayConstElem.raz:3:18: error: a constant holds no variant
2+ 3 | const P: [1]S = [a];
3+ | ^
44 raz: 1 error

test/msg/StmtErrType.err (history) modified +1 -1

@@ -1,4 +1,4 @@
1-conform/err/StmtErrType.raz:2:10: error: only an ERROR or an array constant has a type
1+conform/err/StmtErrType.raz:2:10: error: only an ERROR, an array or a record constant has a type
22 2 | const k: I64 = "a";
33 | ^^^
44 raz: 1 error