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:
@@ -12,26 +12,26 @@
|
||||
|
||||
E :: error { Bad, Empty }
|
||||
|
||||
parse :: (n: s32) -> (s32, s32, !E) {
|
||||
parse :: (n: i32) -> (i32, i32, !E) {
|
||||
if n < 0 { raise error.Bad; }
|
||||
if n == 0 { raise error.Empty; }
|
||||
return (n * 2, n + 1); // success → {n*2, n+1, 0}
|
||||
}
|
||||
|
||||
// Multi-value `try` in a multi-value caller — propagates {undef, undef, tag}.
|
||||
inc :: (n: s32) -> (s32, s32, !E) {
|
||||
inc :: (n: i32) -> (i32, i32, !E) {
|
||||
v, b := try parse(n);
|
||||
return (v + 1, b + 1);
|
||||
}
|
||||
|
||||
// Multi-value `catch`, bare-expression tuple fallback (absorbs the failure).
|
||||
safe :: (n: s32) -> s32 {
|
||||
safe :: (n: i32) -> i32 {
|
||||
v, b := parse(n) catch (e) (40, 50);
|
||||
return v + b;
|
||||
}
|
||||
|
||||
// Multi-value `catch` match-body — per-tag dispatch, each arm a value-tuple.
|
||||
classify :: (n: s32) -> s32 {
|
||||
classify :: (n: i32) -> i32 {
|
||||
v, b := parse(n) catch (e) == {
|
||||
case .Bad: (1, 1);
|
||||
case .Empty: (2, 2);
|
||||
@@ -41,13 +41,13 @@ classify :: (n: s32) -> s32 {
|
||||
}
|
||||
|
||||
// Multi-value `or (tuple)` value-terminator (absorbs the failure).
|
||||
ortest :: (n: s32) -> s32 {
|
||||
ortest :: (n: i32) -> i32 {
|
||||
v, b := parse(n) or (7, 8);
|
||||
return v + b;
|
||||
}
|
||||
|
||||
main :: () -> s32 {
|
||||
r : s32 = 0;
|
||||
main :: () -> i32 {
|
||||
r : i32 = 0;
|
||||
|
||||
// Destructure binds EVERY slot including the error tag (e1 / e2 / e3) —
|
||||
// the error is treated, never dropped.
|
||||
|
||||
Reference in New Issue
Block a user