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:
agra
2026-06-12 09:31:53 +03:00
parent 515ecebea7
commit d8076b9333
1054 changed files with 6836 additions and 6839 deletions

View File

@@ -61,7 +61,7 @@ pub fn lowerIfExpr(self: *Lowering, ie: *const ast.IfExpr) Ref {
// Optional binding: `if val := expr { ... }`
// Clear target_type so the ternary's result type doesn't leak into the condition
// (e.g., `if x != 0 then 1.0 else 2.0` — the `0` must be s64, not f32)
// (e.g., `if x != 0 then 1.0 else 2.0` — the `0` must be i64, not f32)
const saved_cond_target = self.target_type;
self.target_type = null;
const opt_val = self.lowerExpr(ie.condition);
@@ -273,12 +273,12 @@ pub fn listView(self: *Lowering, value: Ref, ty: TypeId) ?struct { data: Ref, da
return .{
.data = self.builder.emit(.{ .struct_get = .{ .base = value, .field_index = items_idx.? } }, items_ty),
.data_ty = items_ty,
.len = self.builder.emit(.{ .struct_get = .{ .base = value, .field_index = len_idx.? } }, .s64),
.len = self.builder.emit(.{ .struct_get = .{ .base = value, .field_index = len_idx.? } }, .i64),
};
}
/// Lowered prep for one position of a multi-iterable `for` header. Every
/// position gets its own s64 cursor slot (ranges start at their `start`,
/// position gets its own i64 cursor slot (ranges start at their `start`,
/// collections at 0); all cursors advance by 1 per iteration, and ONLY the
/// first position's bound terminates the loop (first-iterable-wins).
const IterPrep = struct {
@@ -316,13 +316,13 @@ pub fn lowerFor(self: *Lowering, fe: *const ast.ForExpr) Ref {
for (fe.iterables, 0..) |it, i| {
if (it.is_range) {
var start_ref = self.lowerExpr(it.expr);
if (it.start_exclusive) start_ref = self.builder.add(start_ref, self.builder.constInt(1, .s64), .s64);
const slot = self.builder.alloca(.s64);
if (it.start_exclusive) start_ref = self.builder.add(start_ref, self.builder.constInt(1, .i64), .i64);
const slot = self.builder.alloca(.i64);
self.builder.store(slot, start_ref);
if (i == 0) {
// Parser guarantees the first iterable is bounded.
var end_ref = self.lowerExpr(it.range_end.?);
if (it.end_inclusive) end_ref = self.builder.add(end_ref, self.builder.constInt(1, .s64), .s64);
if (it.end_inclusive) end_ref = self.builder.add(end_ref, self.builder.constInt(1, .i64), .i64);
limit = end_ref;
}
preps.append(self.alloc, .{ .is_range = true, .slot = slot }) catch unreachable;
@@ -349,7 +349,7 @@ pub fn lowerFor(self: *Lowering, fe: *const ast.ForExpr) Ref {
data_ty = lv.data_ty;
len = lv.len;
} else if (i == 0) {
len = self.builder.emit(.{ .length = .{ .operand = data } }, .s64);
len = self.builder.emit(.{ .length = .{ .operand = data } }, .i64);
}
const elem_ty = self.getElementType(data_ty);
@@ -367,8 +367,8 @@ pub fn lowerFor(self: *Lowering, fe: *const ast.ForExpr) Ref {
}
const is_array = !data_ty.isBuiltin() and self.module.types.get(data_ty) == .array;
const storage = if (is_array and !was_deref) self.getExprAlloca(it.expr) else null;
const slot = self.builder.alloca(.s64);
self.builder.store(slot, self.builder.constInt(0, .s64));
const slot = self.builder.alloca(.i64);
self.builder.store(slot, self.builder.constInt(0, .i64));
if (i == 0) limit = len;
preps.append(self.alloc, .{
.is_range = false,
@@ -391,7 +391,7 @@ pub fn lowerFor(self: *Lowering, fe: *const ast.ForExpr) Ref {
// Header: first cursor against the first bound.
self.builder.switchToBlock(header_bb);
const cur0 = self.builder.load(preps.items[0].slot, .s64);
const cur0 = self.builder.load(preps.items[0].slot, .i64);
const cmp = self.builder.cmpLt(cur0, limit);
self.builder.condBr(cmp, body_bb, &.{}, exit_bb, &.{});
@@ -404,9 +404,9 @@ pub fn lowerFor(self: *Lowering, fe: *const ast.ForExpr) Ref {
for (fe.captures, 0..) |cap, i| {
const prep = preps.items[i];
const cur = if (i == 0) cur0 else self.builder.load(prep.slot, .s64);
const cur = if (i == 0) cur0 else self.builder.load(prep.slot, .i64);
if (prep.is_range) {
body_scope.put(cap.name, .{ .ref = cur, .ty = .s64, .is_alloca = false });
body_scope.put(cap.name, .{ .ref = cur, .ty = .i64, .is_alloca = false });
continue;
}
const bind_ty = if (cap.by_ref) self.module.types.ptrTo(prep.elem_ty) else prep.elem_ty;
@@ -453,10 +453,10 @@ pub fn lowerFor(self: *Lowering, fe: *const ast.ForExpr) Ref {
// Increment block: advance every cursor and jump back to header.
self.builder.switchToBlock(inc_bb);
{
const one = self.builder.constInt(1, .s64);
const one = self.builder.constInt(1, .i64);
for (preps.items) |prep| {
const cur = self.builder.load(prep.slot, .s64);
const next = self.builder.add(cur, one, .s64);
const cur = self.builder.load(prep.slot, .i64);
const next = self.builder.add(cur, one, .i64);
self.builder.store(prep.slot, next);
}
self.builder.br(header_bb, &.{});
@@ -556,7 +556,7 @@ pub fn lowerInlineRangeFor(self: *Lowering, fe: *const ast.ForExpr) Ref {
// uses like `print(i)`) and as a comptime constant (for
// `xs[i]` substitution).
const v = start + i;
body_scope.put(cap.name, .{ .ref = self.builder.constInt(v, .s64), .ty = .s64, .is_alloca = false });
body_scope.put(cap.name, .{ .ref = self.builder.constInt(v, .i64), .ty = .i64, .is_alloca = false });
var save = CursorSave{ .name = cap.name, .had_prev = false, .prev = undefined };
if (self.comptime_constants.get(cap.name)) |p| {
save.had_prev = true;
@@ -796,11 +796,11 @@ pub fn lowerMatch(self: *Lowering, me: *const ast.MatchExpr) Ref {
}
// Switch on the subject (for type match, subject is either a
// bare TypeId (s64) or an Any-shaped Type value — unbox in the
// bare TypeId (i64) or an Any-shaped Type value — unbox in the
// latter case so the switch sees the i64 type id).
const tag = if (is_type_match) tag_blk: {
if (subject_ty == .any) {
break :tag_blk self.builder.emit(.{ .unbox_any = .{ .operand = subject } }, .s64);
break :tag_blk self.builder.emit(.{ .unbox_any = .{ .operand = subject } }, .i64);
}
break :tag_blk subject;
} else if (is_optional_match) self.builder.emit(.{ .optional_has_value = .{ .operand = subject } }, .bool) else if (is_error_set_match) subject else blk: {
@@ -810,7 +810,7 @@ pub fn lowerMatch(self: *Lowering, me: *const ast.MatchExpr) Ref {
const ty_info = self.module.types.get(subject_ty);
if (ty_info == .tagged_union) break :tt ty_info.tagged_union.tag_type;
}
break :tt .s32;
break :tt .i32;
};
break :blk self.builder.enumTag(subject, tag_ty);
};
@@ -836,7 +836,7 @@ pub fn lowerMatch(self: *Lowering, me: *const ast.MatchExpr) Ref {
if (is_optional_match) {
// For optional match, unwrap the optional value
const opt_info = self.module.types.get(subject_ty);
const child_ty = if (opt_info == .optional) opt_info.optional.child else .s64;
const child_ty = if (opt_info == .optional) opt_info.optional.child else .i64;
const unwrapped = self.builder.emit(.{ .optional_unwrap = .{ .operand = subject } }, child_ty);
arm_scope.put(capture_name, .{ .ref = unwrapped, .ty = child_ty, .is_alloca = false });
} else {