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

@@ -51,12 +51,12 @@ fn expectType(name: []const u8, expected: []const u8) !void {
test "primitive descriptors" {
try expectType("void", "V");
try expectType("bool", "Z");
try expectType("s8", "B");
try expectType("i8", "B");
try expectType("u8", "B");
try expectType("s16", "S");
try expectType("i16", "S");
try expectType("u16", "C");
try expectType("s32", "I");
try expectType("s64", "J");
try expectType("i32", "I");
try expectType("i64", "J");
try expectType("f32", "F");
try expectType("f64", "D");
}
@@ -105,8 +105,8 @@ test "slice of primitive is array descriptor" {
defer arena.deinit();
const aa = arena.allocator();
const s32 = try makeTypeExpr(aa, "s32");
const slice = try makeSlice(aa, s32);
const i32_te = try makeTypeExpr(aa, "i32");
const slice = try makeSlice(aa, i32_te);
var buf: std.ArrayList(u8) = .empty;
defer buf.deinit(a);
@@ -181,11 +181,11 @@ test "deriveMethod respects #jni_method_descriptor override verbatim" {
defer arena.deinit();
const aa = arena.allocator();
// The actual sx signature `(self: *Self) -> s32` would derive to
// The actual sx signature `(self: *Self) -> i32` would derive to
// `()I`. The override should win regardless.
const self_te = try makeTypeExpr(aa, "Self");
const self_ptr = try makePointer(aa, self_te);
const ret = try makeTypeExpr(aa, "s32");
const ret = try makeTypeExpr(aa, "i32");
const method: ast.ForeignMethodDecl = .{
.name = "weirdMethod",
@@ -266,10 +266,10 @@ test "deriveMethod skips implicit self for instance methods" {
defer arena.deinit();
const aa = arena.allocator();
// method: getId :: (self: *Self) -> s32 → ()I
// method: getId :: (self: *Self) -> i32 → ()I
const self_te = try makeTypeExpr(aa, "Self");
const self_ptr = try makePointer(aa, self_te);
const ret = try makeTypeExpr(aa, "s32");
const ret = try makeTypeExpr(aa, "i32");
const method: ast.ForeignMethodDecl = .{
.name = "getId",
@@ -289,9 +289,9 @@ test "deriveMethod for static method emits all params" {
defer arena.deinit();
const aa = arena.allocator();
// static abs :: (n: s32) -> s32 → (I)I
const n_ty = try makeTypeExpr(aa, "s32");
const ret = try makeTypeExpr(aa, "s32");
// static abs :: (n: i32) -> i32 → (I)I
const n_ty = try makeTypeExpr(aa, "i32");
const ret = try makeTypeExpr(aa, "i32");
const method: ast.ForeignMethodDecl = .{
.name = "abs",
@@ -311,10 +311,10 @@ test "deriveMethod with multiple primitive params and void return" {
defer arena.deinit();
const aa = arena.allocator();
// setBounds :: (self: *Self, x: s32, y: s32, w: s32, h: s32) -> void → (IIII)V
// setBounds :: (self: *Self, x: i32, y: i32, w: i32, h: i32) -> void → (IIII)V
const self_te = try makeTypeExpr(aa, "Self");
const self_ptr = try makePointer(aa, self_te);
const s = try makeTypeExpr(aa, "s32");
const s = try makeTypeExpr(aa, "i32");
const method: ast.ForeignMethodDecl = .{
.name = "setBounds",
@@ -334,12 +334,12 @@ test "deriveMethod with slice param" {
defer arena.deinit();
const aa = arena.allocator();
// copy :: (self: *Self, src: []s8) -> s32 → ([B)I
// copy :: (self: *Self, src: []i8) -> i32 → ([B)I
const self_te = try makeTypeExpr(aa, "Self");
const self_ptr = try makePointer(aa, self_te);
const s8 = try makeTypeExpr(aa, "s8");
const src_slice = try makeSlice(aa, s8);
const ret = try makeTypeExpr(aa, "s32");
const i8_te = try makeTypeExpr(aa, "i8");
const src_slice = try makeSlice(aa, i8_te);
const ret = try makeTypeExpr(aa, "i32");
const method: ast.ForeignMethodDecl = .{
.name = "copy",
@@ -380,13 +380,13 @@ test "isJniReturnTypeSupported accepts the dispatchable set + pointers only" {
const t = &table;
// The Call<T>Method-dispatchable primitives.
inline for (.{ types.TypeId.void, types.TypeId.bool, types.TypeId.s32, types.TypeId.s64, types.TypeId.f32, types.TypeId.f64 }) |ty| {
inline for (.{ types.TypeId.void, types.TypeId.bool, types.TypeId.i32, types.TypeId.i64, types.TypeId.f32, types.TypeId.f64 }) |ty| {
try std.testing.expect(desc.isJniReturnTypeSupported(t, ty));
}
// Other primitive widths are NOT dispatchable (would hit emit_llvm's
// undef-producing `else` arm — the footgun this predicate guards).
inline for (.{ types.TypeId.s8, types.TypeId.s16, types.TypeId.u8, types.TypeId.u32, types.TypeId.u64 }) |ty| {
inline for (.{ types.TypeId.i8, types.TypeId.i16, types.TypeId.u8, types.TypeId.u32, types.TypeId.u64 }) |ty| {
try std.testing.expect(!desc.isJniReturnTypeSupported(t, ty));
}