Surface rename of the signed integer family: s1..s64 become i1..i64
(u1..u64, usize, isize unchanged). 'string' keeps the s-prefix arm in
name classification; width parsing moves to the i-prefix arm next to
isize.
Internal TypeId tags follow the surface (.s8/.s16/.s32/.s64 ->
.i8/.i16/.i32/.i64), as do mono-key mangle fragments (ptr_i64,
tu_i64_bool) and all display/diagnostic formatting (i{d}).
Migrated in the same sweep: stdlib + examples + issue repros + FFI C
companions (shared symbol names like ffi_id_i64), expected
stdout/stderr/ir snapshots, specs.md, readme.md, CLAUDE.md/AGENTS.md,
implementation_plan.md, docs/, issue writeups. Vendored stb_image and
historical flow state left untouched.
zig build test: 426/426; examples suite: 595/595.
25 lines
1.1 KiB
Plaintext
25 lines
1.1 KiB
Plaintext
// Error-set declarations + `error.X` tag values + enum-like `==` typing
|
|
// (ERR step E1.1). A declared `error { ... }` set is a real type with a u32
|
|
// runtime layout; `error.X` is its tag value — the named set when context
|
|
// provides one (membership-checked), else the raw global u32 id. Tags compare
|
|
// with an `error.X` literal or another error-set value. The rejections live in
|
|
// `examples/218-error-set-typing.sx`.
|
|
|
|
#import "modules/std.sx";
|
|
|
|
ParseErr :: error { BadDigit, Overflow, Empty }
|
|
|
|
main :: () -> i32 {
|
|
c : ParseErr = error.BadDigit;
|
|
d : ParseErr = error.Overflow;
|
|
r : i32 = 0;
|
|
if c == error.BadDigit { r = r + 1; } // true -> +1
|
|
if c == error.Overflow { r = r + 2; } // false
|
|
if c == d { r = r + 4; } // false (BadDigit != Overflow)
|
|
if d == error.Overflow { r = r + 8; } // true -> +8
|
|
tag : u32 = error.Empty; // u32 context -> raw global tag id
|
|
if tag != 0 { r = r + 16; } // tag ids are >= 1 -> +16
|
|
print("error-set result: {}\n", r); // -> 25
|
|
return r;
|
|
}
|