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

@@ -646,16 +646,16 @@ pub const Server = struct {
const builtins = [_]struct { label: []const u8, detail: []const u8 }{
.{ .label = "type_of", .detail = "(val: $T) -> Type" },
.{ .label = "type_name", .detail = "($T: Type) -> string" },
.{ .label = "field_count", .detail = "($T: Type) -> s32" },
.{ .label = "field_name", .detail = "($T: Type, idx: s32) -> string" },
.{ .label = "field_value", .detail = "(s: $T, idx: s32) -> Any" },
.{ .label = "size_of", .detail = "($T: Type) -> s64" },
.{ .label = "align_of", .detail = "($T: Type) -> s64" },
.{ .label = "field_count", .detail = "($T: Type) -> i32" },
.{ .label = "field_name", .detail = "($T: Type, idx: i32) -> string" },
.{ .label = "field_value", .detail = "(s: $T, idx: i32) -> Any" },
.{ .label = "size_of", .detail = "($T: Type) -> i64" },
.{ .label = "align_of", .detail = "($T: Type) -> i64" },
.{ .label = "cast", .detail = "(Type) expr — prefix type cast" },
.{ .label = "malloc", .detail = "(size: s64) -> *void" },
.{ .label = "malloc", .detail = "(size: i64) -> *void" },
.{ .label = "free", .detail = "(ptr: *void) -> void" },
.{ .label = "memcpy", .detail = "(dst: *void, src: *void, size: s64) -> *void" },
.{ .label = "memset", .detail = "(dst: *void, val: s64, size: s64) -> void" },
.{ .label = "memcpy", .detail = "(dst: *void, src: *void, size: i64) -> *void" },
.{ .label = "memset", .detail = "(dst: *void, val: i64, size: i64) -> void" },
.{ .label = "sqrt", .detail = "(x: $T) -> T" },
};
for (&keywords) |kw| {
@@ -1116,16 +1116,16 @@ pub const Server = struct {
const builtin_sigs = [_]struct { name: []const u8, label: []const u8, params: []const []const u8 }{
.{ .name = "type_of", .label = "type_of(val: $T) -> Type", .params = &.{"val: $T"} },
.{ .name = "type_name", .label = "type_name($T: Type) -> string", .params = &.{"$T: Type"} },
.{ .name = "field_count", .label = "field_count($T: Type) -> s32", .params = &.{"$T: Type"} },
.{ .name = "field_name", .label = "field_name($T: Type, idx: s32) -> string", .params = &.{ "$T: Type", "idx: s32" } },
.{ .name = "field_value", .label = "field_value(s: $T, idx: s32) -> Any", .params = &.{ "s: $T", "idx: s32" } },
.{ .name = "size_of", .label = "size_of($T: Type) -> s64", .params = &.{"$T: Type"} },
.{ .name = "align_of", .label = "align_of($T: Type) -> s64", .params = &.{"$T: Type"} },
.{ .name = "field_count", .label = "field_count($T: Type) -> i32", .params = &.{"$T: Type"} },
.{ .name = "field_name", .label = "field_name($T: Type, idx: i32) -> string", .params = &.{ "$T: Type", "idx: i32" } },
.{ .name = "field_value", .label = "field_value(s: $T, idx: i32) -> Any", .params = &.{ "s: $T", "idx: i32" } },
.{ .name = "size_of", .label = "size_of($T: Type) -> i64", .params = &.{"$T: Type"} },
.{ .name = "align_of", .label = "align_of($T: Type) -> i64", .params = &.{"$T: Type"} },
.{ .name = "cast", .label = "cast(Type) expr", .params = &.{"Type"} },
.{ .name = "malloc", .label = "malloc(size: s64) -> *void", .params = &.{"size: s64"} },
.{ .name = "malloc", .label = "malloc(size: i64) -> *void", .params = &.{"size: i64"} },
.{ .name = "free", .label = "free(ptr: *void) -> void", .params = &.{"ptr: *void"} },
.{ .name = "memcpy", .label = "memcpy(dst: *void, src: *void, size: s64) -> *void", .params = &.{ "dst: *void", "src: *void", "size: s64" } },
.{ .name = "memset", .label = "memset(dst: *void, val: s64, size: s64) -> void", .params = &.{ "dst: *void", "val: s64", "size: s64" } },
.{ .name = "memcpy", .label = "memcpy(dst: *void, src: *void, size: i64) -> *void", .params = &.{ "dst: *void", "src: *void", "size: i64" } },
.{ .name = "memset", .label = "memset(dst: *void, val: i64, size: i64) -> void", .params = &.{ "dst: *void", "val: i64", "size: i64" } },
.{ .name = "sqrt", .label = "sqrt(x: $T) -> T", .params = &.{"x: $T"} },
.{ .name = "print", .label = "print(fmt: string, args: ..Any)", .params = &.{ "fmt: string", "args: ..Any" } },
.{ .name = "out", .label = "out(str: string) -> void", .params = &.{"str: string"} },
@@ -3188,7 +3188,7 @@ test "analyzeDocument: parse and sema basic function" {
const alloc = arena.allocator();
var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{});
const src: [:0]const u8 = "add :: (a: s32, b: s32) -> s32 { a + b; }";
const src: [:0]const u8 = "add :: (a: i32, b: i32) -> i32 { a + b; }";
const doc = try store.openOrUpdate("main.sx", src, 1);
try store.analyzeDocument(doc);
@@ -3207,14 +3207,14 @@ test "analyzeDocument: flat import pre-registers symbols" {
var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{});
// Pre-load the imported module
const lib_src: [:0]const u8 = "mul :: (a: s32, b: s32) -> s32 { a * b; }";
const lib_src: [:0]const u8 = "mul :: (a: i32, b: i32) -> i32 { a * b; }";
const lib_doc = try store.openOrUpdate("lib.sx", lib_src, 1);
try store.analyzeDocument(lib_doc);
// Load main file with flat import
const main_src: [:0]const u8 =
\\#import "lib.sx";
\\main :: () -> s32 { mul(3, 4); }
\\main :: () -> i32 { mul(3, 4); }
;
const main_doc = try store.openOrUpdate("main.sx", main_src, 1);
try store.analyzeDocument(main_doc);
@@ -3234,14 +3234,14 @@ test "analyzeDocument: namespaced import registers namespace symbol" {
var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{});
// Pre-load the imported module
const lib_src: [:0]const u8 = "add :: (a: s32, b: s32) -> s32 { a + b; }";
const lib_src: [:0]const u8 = "add :: (a: i32, b: i32) -> i32 { a + b; }";
const lib_doc = try store.openOrUpdate("lib.sx", lib_src, 1);
try store.analyzeDocument(lib_doc);
// Load main file with namespaced import
const main_src: [:0]const u8 =
\\pkg :: #import "lib.sx";
\\main :: () -> s32 { pkg.add(3, 4); }
\\main :: () -> i32 { pkg.add(3, 4); }
;
const main_doc = try store.openOrUpdate("main.sx", main_src, 1);
try store.analyzeDocument(main_doc);
@@ -3260,13 +3260,13 @@ test "analyzeDocument: namespaced import fn_signatures have prefix" {
var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{});
const lib_src: [:0]const u8 = "add :: (a: s32, b: s32) -> s32 { a + b; }";
const lib_src: [:0]const u8 = "add :: (a: i32, b: i32) -> i32 { a + b; }";
const lib_doc = try store.openOrUpdate("lib.sx", lib_src, 1);
try store.analyzeDocument(lib_doc);
const main_src: [:0]const u8 =
\\pkg :: #import "lib.sx";
\\main :: () -> s32 { pkg.add(1, 2); }
\\main :: () -> i32 { pkg.add(1, 2); }
;
const main_doc = try store.openOrUpdate("main.sx", main_src, 1);
try store.analyzeDocument(main_doc);
@@ -3283,14 +3283,14 @@ test "analyzeDocument: pipe operator desugars to call" {
var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{});
const lib_src: [:0]const u8 = "add :: (a: s32, b: s32) -> s32 { a + b; }";
const lib_src: [:0]const u8 = "add :: (a: i32, b: i32) -> i32 { a + b; }";
const lib_doc = try store.openOrUpdate("lib.sx", lib_src, 1);
try store.analyzeDocument(lib_doc);
// Pipe operator should parse and analyze without errors
const main_src: [:0]const u8 =
\\pkg :: #import "lib.sx";
\\main :: () -> s32 { 3 |> pkg.add(4); }
\\main :: () -> i32 { 3 |> pkg.add(4); }
;
const main_doc = try store.openOrUpdate("main.sx", main_src, 1);
try store.analyzeDocument(main_doc);
@@ -3309,7 +3309,7 @@ test "analyzeDocument: for-loop capture variables are registered" {
const src: [:0]const u8 =
\\main :: () {
\\ arr : [3]s32 = ---;
\\ arr : [3]i32 = ---;
\\ for arr, 0.. (it, ix) {
\\ x := it + ix;
\\ }
@@ -3335,7 +3335,7 @@ test "analyzeDocument: for-loop with underscore capture" {
const src: [:0]const u8 =
\\main :: () {
\\ arr : [3]s32 = ---;
\\ arr : [3]i32 = ---;
\\ for arr, 0.. (_, ix) {
\\ x := ix;
\\ }
@@ -3360,7 +3360,7 @@ test "analyzeDocument: for-loop value-only capture" {
const src: [:0]const u8 =
\\main :: () {
\\ arr : [3]s32 = ---;
\\ arr : [3]i32 = ---;
\\ for arr (val) {
\\ x := val;
\\ }
@@ -3393,13 +3393,13 @@ test "lsp/references: a field's uses are found across documents" {
var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{});
const lib_src: [:0]const u8 = "Move :: struct { flag: s64; }";
const lib_src: [:0]const u8 = "Move :: struct { flag: i64; }";
const lib_doc = try store.openOrUpdate("lib.sx", lib_src, 1);
try store.analyzeDocument(lib_doc);
const main_src: [:0]const u8 =
\\#import "lib.sx";
\\use :: (m: *Move) -> s64 { m.flag; }
\\use :: (m: *Move) -> i64 { m.flag; }
;
const main_doc = try store.openOrUpdate("main.sx", main_src, 1);
try store.analyzeDocument(main_doc);
@@ -3423,7 +3423,7 @@ test "lsp/references: excluding the declaration drops the definition" {
const alloc = arena.allocator();
var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{});
const src: [:0]const u8 = "Move :: struct { flag: s64; } use :: (m: *Move) -> s64 { m.flag; }";
const src: [:0]const u8 = "Move :: struct { flag: i64; } use :: (m: *Move) -> i64 { m.flag; }";
const doc = try store.openOrUpdate("main.sx", src, 1);
try store.analyzeDocument(doc);
@@ -3442,7 +3442,7 @@ test "lsp/definition: cursor on a member declaration resolves to itself" {
const alloc = arena.allocator();
var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{});
const src: [:0]const u8 = "Move :: struct { flag: s64; }";
const src: [:0]const u8 = "Move :: struct { flag: i64; }";
const doc = try store.openOrUpdate("main.sx", src, 1);
try store.analyzeDocument(doc);
const sema = doc.sema orelse return error.SkipZigTest;
@@ -3465,8 +3465,8 @@ test "lsp/inlayHint: a for-loop capture in a struct method shows its element typ
var store = doc_mod.DocumentStore.init(alloc, test_io(), &.{});
const lib_src: [:0]const u8 =
\\Move :: struct { flag: s64; }
\\List :: struct ($T: Type) { items: [*]T = null; len: s64 = 0; }
\\Move :: struct { flag: i64; }
\\List :: struct ($T: Type) { items: [*]T = null; len: i64 = 0; }
;
const lib_doc = try store.openOrUpdate("lib.sx", lib_src, 1);
try store.analyzeDocument(lib_doc);
@@ -3509,8 +3509,8 @@ test "lsp/workspace: loadWorkspaceFiles analyses .sx files that were never opene
std.Io.Dir.deleteFile(.cwd(), io, dir ++ "/b.sx") catch {};
std.Io.Dir.deleteDir(.cwd(), io, dir) catch {};
}
try std.Io.Dir.writeFile(.cwd(), io, .{ .sub_path = dir ++ "/a.sx", .data = "Foo :: struct { x: s64; }" });
try std.Io.Dir.writeFile(.cwd(), io, .{ .sub_path = dir ++ "/b.sx", .data = "Bar :: struct { y: s64; }" });
try std.Io.Dir.writeFile(.cwd(), io, .{ .sub_path = dir ++ "/a.sx", .data = "Foo :: struct { x: i64; }" });
try std.Io.Dir.writeFile(.cwd(), io, .{ .sub_path = dir ++ "/b.sx", .data = "Bar :: struct { y: i64; }" });
var store = doc_mod.DocumentStore.init(alloc, io, &.{});
store.root_path = dir;
@@ -3541,12 +3541,12 @@ test "lsp/project: whole-program check attributes a reachable error to its modul
// only sees because `main` calls `use` (reachability). Lowering mod.sx alone
// would miss it; the whole-program check catches it and pins it to mod.sx.
try std.Io.Dir.writeFile(.cwd(), io, .{ .sub_path = dir ++ "/mod.sx", .data =
"Move :: struct { flag: s64; }\n" ++
"take :: (m: Move) -> s64 { return m.flag; }\n" ++
"use :: (p: *Move) -> s64 { return take(p); }\n" });
"Move :: struct { flag: i64; }\n" ++
"take :: (m: Move) -> i64 { return m.flag; }\n" ++
"use :: (p: *Move) -> i64 { return take(p); }\n" });
try std.Io.Dir.writeFile(.cwd(), io, .{ .sub_path = dir ++ "/main.sx", .data =
"#import \"mod.sx\";\n" ++
"main :: () -> s32 { mv : Move = .{ flag = 1 }; return xx use(@mv); }\n" });
"main :: () -> i32 { mv : Move = .{ flag = 1 }; return xx use(@mv); }\n" });
const store = doc_mod.DocumentStore.init(alloc, io, &.{});
var server = Server{