lang: rename signed integer types sN -> iN
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.
This commit is contained in:
@@ -28,38 +28,38 @@ classify :: (s: string) -> (Color, !E) {
|
||||
}
|
||||
|
||||
// F2: comptime parameter forces inline lowering of the body.
|
||||
ct_pick :: ($n: s32, s: string) -> (Color, !E) {
|
||||
ct_pick :: ($n: i32, s: string) -> (Color, !E) {
|
||||
if s == "red" { return .red; } // bare value, inline path → {0, 0}
|
||||
if s == "blue" { return .blue; } // bare value, inline path → {2, 0}
|
||||
raise error.Nope; // inline error path → {undef, 1}
|
||||
}
|
||||
|
||||
main :: () -> s32 {
|
||||
main :: () -> i32 {
|
||||
// ── F1 success (bare value, explicit-tuple error fn): error slot 0 ──
|
||||
c, e := classify("ok");
|
||||
print("F1 ok: err int = {}\n", cast(s64) e); // 0
|
||||
print("F1 ok: err int = {}\n", cast(i64) e); // 0
|
||||
if e { print("F1 ok bare-if: ERROR (WRONG)\n"); } else { print("F1 ok bare-if: ok\n"); }
|
||||
if !e { print("F1 ok guard: c = {}\n", cast(s64) c); } // 2 (blue)
|
||||
if !e { print("F1 ok guard: c = {}\n", cast(i64) c); } // 2 (blue)
|
||||
|
||||
// ── F1 error (explicit tuple): right tag flows, no panic ──
|
||||
c2, e2 := classify("bad");
|
||||
print("F1 bad: err nonzero = {}\n", cast(s64) e2 != 0); // true (ordinal is program-global, not pinned)
|
||||
print("F1 bad: err nonzero = {}\n", cast(i64) e2 != 0); // true (ordinal is program-global, not pinned)
|
||||
if e2 == error.Nope { print("F1 bad: is Nope (ok)\n"); } else { print("F1 bad: not Nope (WRONG)\n"); }
|
||||
print("F1 bad: tag name = {}\n", error_tag_name(e2)); // Nope
|
||||
|
||||
// ── F2 success (comptime-param, inline path): error slot 0 at runtime ──
|
||||
c3, e3 := ct_pick(7, "red");
|
||||
print("F2 red: err int = {}\n", cast(s64) e3); // 0
|
||||
print("F2 red: err int = {}\n", cast(i64) e3); // 0
|
||||
if e3 { print("F2 red bare-if: ERROR (WRONG)\n"); } else { print("F2 red bare-if: ok\n"); }
|
||||
if e3 == error.Nope { print("F2 red == Nope (WRONG)\n"); } else { print("F2 red != Nope (ok)\n"); }
|
||||
if !e3 { print("F2 red guard: c = {}\n", cast(s64) c3); } // 0
|
||||
if !e3 { print("F2 red guard: c = {}\n", cast(i64) c3); } // 0
|
||||
|
||||
c4, e4 := ct_pick(7, "blue");
|
||||
if !e4 { print("F2 blue: err int = {}, c = {}\n", cast(s64) e4, cast(s64) c4); } // 0, 2
|
||||
if !e4 { print("F2 blue: err int = {}, c = {}\n", cast(i64) e4, cast(i64) c4); } // 0, 2
|
||||
|
||||
// ── F2 error (comptime-param, inline error path): right tag ──
|
||||
c5, e5 := ct_pick(7, "x");
|
||||
print("F2 err: err nonzero = {}\n", cast(s64) e5 != 0); // true (ordinal is program-global, not pinned)
|
||||
print("F2 err: err nonzero = {}\n", cast(i64) e5 != 0); // true (ordinal is program-global, not pinned)
|
||||
if e5 == error.Nope { print("F2 err: is Nope (ok)\n"); } else { print("F2 err: not Nope (WRONG)\n"); }
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user