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

@@ -329,7 +329,7 @@ pub fn lowerVarDecl(self: *Lowering, vd: *const ast.VarDecl) void {
}
}
}
// Coerce value to match target type (e.g. u8 → s64 widening)
// Coerce value to match target type (e.g. u8 → i64 widening)
{
const ref_ty = self.builder.getRefType(ref);
if (ref_ty != ty and ref_ty != .void and ty != .void) {
@@ -354,7 +354,7 @@ pub fn lowerVarDecl(self: *Lowering, vd: *const ast.VarDecl) void {
self.force_block_value = true;
// An unannotated decl provides no target type: clear the ambient one
// (the enclosing fn's implicit-return target) so literal initializers
// take their spec defaults (s64/f64) instead of adopting it.
// take their spec defaults (i64/f64) instead of adopting it.
self.target_type = null;
const ref = self.lowerExpr(val);
self.force_block_value = saved_fbv;
@@ -366,7 +366,7 @@ pub fn lowerVarDecl(self: *Lowering, vd: *const ast.VarDecl) void {
scope.put(vd.name, .{ .ref = slot, .ty = ty, .is_alloca = true });
}
} else {
const ty = TypeId.s64;
const ty = TypeId.i64;
const slot = self.builder.alloca(ty);
self.builder.store(slot, self.zeroValue(ty));
if (self.scope) |scope| {
@@ -390,7 +390,7 @@ pub fn lowerLocalFnDecl(self: *Lowering, fd: *const ast.FnDecl) void {
}
pub fn lowerConstDecl(self: *Lowering, cd: *const ast.ConstDecl) void {
// Handle local function declarations: fx :: (s:s3) -> s3 { ... }
// Handle local function declarations: fx :: (s:i3) -> i3 { ... }
if (cd.value.data == .fn_decl) {
const fd = &cd.value.data.fn_decl;
// Use mangled name for local functions to support block-scoped shadowing
@@ -448,15 +448,15 @@ pub fn lowerReturn(self: *Lowering, rs: *const ast.ReturnStmt) void {
}
// Set target_type to function return type so null_literal etc. get the right type.
// When inlining a comptime body, the *inlined* fn's declared return type wins
// over the caller's — otherwise `return 42` inside a `-> s64` body lowered into
// a `-> s32` caller would coerce 42 to s32 before storing into the s64 slot.
// over the caller's — otherwise `return 42` inside a `-> i64` body lowered into
// a `-> i32` caller would coerce 42 to i32 before storing into the i64 slot.
const old_target = self.target_type;
const ret_ty_for_target: TypeId = if (self.inline_return_target) |iri|
iri.ret_ty
else if (self.builder.func) |fid|
self.module.functions.items[@intFromEnum(fid)].ret
else
TypeId.s64;
TypeId.i64;
// A value-carrying failable (`-> (T..., !)`) returns its VALUE part and
// the success error slot (0) is appended by lowerFailableSuccessReturn.
// Resolve a BARE returned value against that value type, NOT the failable
@@ -523,7 +523,7 @@ pub fn lowerReturn(self: *Lowering, rs: *const ast.ReturnStmt) void {
const ret_ty = if (self.builder.func) |fid|
self.module.functions.items[@intFromEnum(fid)].ret
else
TypeId.s64;
TypeId.i64;
if (ret_ty == .void) {
// Void function — just return void (the value expression was evaluated for side effects)
self.builder.retVoid();
@@ -532,7 +532,7 @@ pub fn lowerReturn(self: *Lowering, rs: *const ast.ReturnStmt) void {
// value part; the compiler appends the success error slot (0).
self.lowerFailableSuccessReturn(ref, ret_ty, rs.value.?.span);
} else {
// Coerce return value to match function return type (e.g., ?s32 → s32)
// Coerce return value to match function return type (e.g., ?i32 → i32)
const val_ty = self.builder.getRefType(ref);
const coerced = self.coerceToType(ref, val_ty, ret_ty);
self.builder.ret(coerced, ret_ty);
@@ -748,11 +748,11 @@ pub fn lowerAssignment(self: *Lowering, asgn: *const ast.Assignment) void {
} else false);
if (is_special_container and std.mem.eql(u8, fa.field, "len")) {
const gep = self.builder.structGepTyped(obj_ptr, 1, .s64, obj_ty);
self.storeOrCompound(gep, val, asgn.op, .s64);
const gep = self.builder.structGepTyped(obj_ptr, 1, .i64, obj_ty);
self.storeOrCompound(gep, val, asgn.op, .i64);
} else if (is_special_container and std.mem.eql(u8, fa.field, "ptr")) {
const gep = self.builder.structGepTyped(obj_ptr, 0, .s64, obj_ty);
self.storeOrCompound(gep, val, asgn.op, .s64);
const gep = self.builder.structGepTyped(obj_ptr, 0, .i64, obj_ty);
self.storeOrCompound(gep, val, asgn.op, .i64);
} else if (self.fieldLvaluePtr(obj_ptr, obj_ty, fa.field)) |fl| {
// Resolve the target field (struct / union direct / promoted
// anonymous-struct member / tuple element / vector lane) via
@@ -986,7 +986,7 @@ pub fn lowerExprAsPtr(self: *Lowering, node: *const Node) Ref {
// resolver so address-of and the multi-target store path never
// disagree on the slot. No match → emit the read path's
// field-not-found diagnostic (lowerFieldAccessOnType →
// emitFieldError) instead of silently GEPing field 0 as .s64;
// emitFieldError) instead of silently GEPing field 0 as .i64;
// that bogus pointer reaches LLVM emission as ptrTo(.unresolved)
// and panics.
if (self.fieldLvaluePtr(obj_ptr, obj_ty, fa.field)) |r| return r.ptr;