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:
@@ -34,7 +34,7 @@ test "generics: mangleTypeName encodes the mono-key fragment per type shape" {
|
||||
|
||||
// Builtins — the leaf fragments `mangleGenericName` concatenates per
|
||||
// bound type param (`base__<frag>...`).
|
||||
try std.testing.expectEqualStrings("s64", gr.mangleTypeName(.s64));
|
||||
try std.testing.expectEqualStrings("i64", gr.mangleTypeName(.i64));
|
||||
try std.testing.expectEqualStrings("u8", gr.mangleTypeName(.u8));
|
||||
try std.testing.expectEqualStrings("f32", gr.mangleTypeName(.f32));
|
||||
try std.testing.expectEqualStrings("bool", gr.mangleTypeName(.bool));
|
||||
@@ -42,12 +42,12 @@ test "generics: mangleTypeName encodes the mono-key fragment per type shape" {
|
||||
try std.testing.expectEqualStrings("string", gr.mangleTypeName(.string));
|
||||
|
||||
// Compound shapes — prefix + recursive inner fragment.
|
||||
try std.testing.expectEqualStrings("ptr_s64", gr.mangleTypeName(tt.ptrTo(.s64)));
|
||||
try std.testing.expectEqualStrings("opt_s64", gr.mangleTypeName(tt.optionalOf(.s64)));
|
||||
try std.testing.expectEqualStrings("ptr_i64", gr.mangleTypeName(tt.ptrTo(.i64)));
|
||||
try std.testing.expectEqualStrings("opt_i64", gr.mangleTypeName(tt.optionalOf(.i64)));
|
||||
try std.testing.expectEqualStrings("ptr_opt_u8", gr.mangleTypeName(tt.ptrTo(tt.optionalOf(.u8))));
|
||||
try std.testing.expectEqualStrings("SL_f64", gr.mangleTypeName(tt.intern(.{ .slice = .{ .element = .f64 } })));
|
||||
try std.testing.expectEqualStrings("mptr_u8", gr.mangleTypeName(tt.intern(.{ .many_pointer = .{ .element = .u8 } })));
|
||||
try std.testing.expectEqualStrings("AR_4_s32", gr.mangleTypeName(tt.intern(.{ .array = .{ .element = .s32, .length = 4 } })));
|
||||
try std.testing.expectEqualStrings("AR_4_i32", gr.mangleTypeName(tt.intern(.{ .array = .{ .element = .i32, .length = 4 } })));
|
||||
try std.testing.expectEqualStrings("vec_3_f32", gr.mangleTypeName(tt.intern(.{ .vector = .{ .element = .f32, .length = 3 } })));
|
||||
|
||||
// Named aggregate → its declared name.
|
||||
@@ -55,11 +55,11 @@ test "generics: mangleTypeName encodes the mono-key fragment per type shape" {
|
||||
try std.testing.expectEqualStrings("Point", gr.mangleTypeName(pt));
|
||||
|
||||
// Tuple: "tu" + "_<frag>" per field.
|
||||
const tup = tt.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .s64, .bool }, .names = null } });
|
||||
try std.testing.expectEqualStrings("tu_s64_bool", gr.mangleTypeName(tup));
|
||||
const tup = tt.intern(.{ .tuple = .{ .fields = &[_]TypeId{ .i64, .bool }, .names = null } });
|
||||
try std.testing.expectEqualStrings("tu_i64_bool", gr.mangleTypeName(tup));
|
||||
|
||||
// The `Lowering` wrapper delegates here — same result.
|
||||
try std.testing.expectEqualStrings("ptr_s64", l.mangleTypeName(tt.ptrTo(.s64)));
|
||||
try std.testing.expectEqualStrings("ptr_i64", l.mangleTypeName(tt.ptrTo(.i64)));
|
||||
}
|
||||
|
||||
test "generics: inferGenericReturnType binds explicit type args, resolves return, restores bindings" {
|
||||
@@ -100,8 +100,8 @@ test "generics: inferGenericReturnType binds explicit type args, resolves return
|
||||
}
|
||||
}.f;
|
||||
|
||||
const c_s64 = mkCall(alloc, "s64");
|
||||
try std.testing.expectEqual(TypeId.s64, gr.inferGenericReturnType(&fd, &c_s64));
|
||||
const c_i64 = mkCall(alloc, "i64");
|
||||
try std.testing.expectEqual(TypeId.i64, gr.inferGenericReturnType(&fd, &c_i64));
|
||||
const c_f64 = mkCall(alloc, "f64");
|
||||
try std.testing.expectEqual(TypeId.f64, gr.inferGenericReturnType(&fd, &c_f64));
|
||||
|
||||
@@ -145,14 +145,14 @@ test "generics: buildTypeBindings infers a type param from value args, widest wi
|
||||
}
|
||||
}.f;
|
||||
|
||||
// add(1, 2) — both args s64 → T = s64.
|
||||
// add(1, 2) — both args i64 → T = i64.
|
||||
{
|
||||
const args = [_]*const Node{ intLit(alloc, 1), intLit(alloc, 2) };
|
||||
var bindings = gr.buildTypeBindings(&fd, &args);
|
||||
defer bindings.deinit();
|
||||
try std.testing.expectEqual(TypeId.s64, bindings.get("T").?);
|
||||
try std.testing.expectEqual(TypeId.i64, bindings.get("T").?);
|
||||
}
|
||||
// add(1.0, 2) — mixed f64/s64 → widest f64 wins regardless of order.
|
||||
// add(1.0, 2) — mixed f64/i64 → widest f64 wins regardless of order.
|
||||
{
|
||||
const args = [_]*const Node{ floatLit(alloc, 1.0), intLit(alloc, 2) };
|
||||
var bindings = gr.buildTypeBindings(&fd, &args);
|
||||
|
||||
Reference in New Issue
Block a user