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

@@ -29,28 +29,28 @@ test "conversions: classify covers the built-in coercion ladder" {
const tt = &module.types;
// no-op + Any box/unbox.
try std.testing.expectEqual(Plan.no_op, cr.classify(.s64, .s64));
try std.testing.expectEqual(Plan.unbox_any, cr.classify(.any, .s64));
try std.testing.expectEqual(Plan.box_any, cr.classify(.s64, .any));
try std.testing.expectEqual(Plan.no_op, cr.classify(.i64, .i64));
try std.testing.expectEqual(Plan.unbox_any, cr.classify(.any, .i64));
try std.testing.expectEqual(Plan.box_any, cr.classify(.i64, .any));
// Numeric / pointer ladder.
try std.testing.expectEqual(Plan.widen, cr.classify(.s32, .s64));
try std.testing.expectEqual(Plan.narrow, cr.classify(.s64, .s32));
try std.testing.expectEqual(Plan.int_to_float, cr.classify(.s32, .f64));
try std.testing.expectEqual(Plan.float_to_int, cr.classify(.f64, .s32));
const ptr_s64 = tt.ptrTo(.s64);
try std.testing.expectEqual(Plan.ptr_int_bitcast, cr.classify(ptr_s64, .s64));
try std.testing.expectEqual(Plan.ptr_int_bitcast, cr.classify(.s64, ptr_s64));
try std.testing.expectEqual(Plan.widen, cr.classify(.i32, .i64));
try std.testing.expectEqual(Plan.narrow, cr.classify(.i64, .i32));
try std.testing.expectEqual(Plan.int_to_float, cr.classify(.i32, .f64));
try std.testing.expectEqual(Plan.float_to_int, cr.classify(.f64, .i32));
const ptr_i64 = tt.ptrTo(.i64);
try std.testing.expectEqual(Plan.ptr_int_bitcast, cr.classify(ptr_i64, .i64));
try std.testing.expectEqual(Plan.ptr_int_bitcast, cr.classify(.i64, ptr_i64));
// Optional wrap / unwrap, and void → optional.
const opt_s64 = tt.optionalOf(.s64);
try std.testing.expectEqual(Plan.optional_wrap, cr.classify(.s64, opt_s64));
try std.testing.expectEqual(Plan.optional_unwrap, cr.classify(opt_s64, .s64));
try std.testing.expectEqual(Plan.void_to_optional, cr.classify(.void, opt_s64));
const opt_i64 = tt.optionalOf(.i64);
try std.testing.expectEqual(Plan.optional_wrap, cr.classify(.i64, opt_i64));
try std.testing.expectEqual(Plan.optional_unwrap, cr.classify(opt_i64, .i64));
try std.testing.expectEqual(Plan.void_to_optional, cr.classify(.void, opt_i64));
// Tuple → tuple, same arity.
const t_ss = tt.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .s64, .s64 }, .names = null } });
const t_ii = tt.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .s32, .s32 }, .names = null } });
const t_ss = tt.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .i64, .i64 }, .names = null } });
const t_ii = tt.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .i32, .i32 }, .names = null } });
try std.testing.expectEqual(Plan.tuple_elementwise, cr.classify(t_ss, t_ii));
// Closure value → bare fn-ptr: rejected.
@@ -100,17 +100,17 @@ test "conversions: classifyXX picks the xx-operator head decision" {
const drawable = tt.findByName(tt.internString("Drawable")).?;
// Any source unboxes regardless of dst.
try std.testing.expectEqual(XXPlan.unbox_any, cr.classifyXX(.any, .s64));
try std.testing.expectEqual(XXPlan.unbox_any, cr.classifyXX(.any, .i64));
// Same type → no-op.
try std.testing.expectEqual(XXPlan.no_op, cr.classifyXX(.s64, .s64));
try std.testing.expectEqual(XXPlan.no_op, cr.classifyXX(.i64, .i64));
// dst is a protocol → erasure (checked before the src-protocol case).
try std.testing.expectEqual(XXPlan.erase_protocol, cr.classifyXX(.s64, drawable));
try std.testing.expectEqual(XXPlan.erase_protocol, cr.classifyXX(.i64, drawable));
// src is a protocol, dst is a pointer → recover the ctx pointer.
try std.testing.expectEqual(XXPlan.protocol_to_pointer, cr.classifyXX(drawable, tt.ptrTo(.s64)));
try std.testing.expectEqual(XXPlan.protocol_to_pointer, cr.classifyXX(drawable, tt.ptrTo(.i64)));
// src is a protocol but dst is NOT a pointer → fall to the ladder.
try std.testing.expectEqual(XXPlan.coerce, cr.classifyXX(drawable, .s64));
try std.testing.expectEqual(XXPlan.coerce, cr.classifyXX(drawable, .i64));
// Pointer materialization (`xx value` into a `*T` slot, no built-in) defers
// to the ladder + the user-`Into` pointer fallback in lowerXX.
const a = tt.intern(.{ .@"struct" = .{ .name = tt.internString("A"), .fields = &.{} } });
try std.testing.expectEqual(XXPlan.coerce, cr.classifyXX(a, tt.ptrTo(.s32)));
try std.testing.expectEqual(XXPlan.coerce, cr.classifyXX(a, tt.ptrTo(.i32)));
}