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

@@ -136,8 +136,8 @@ pub const UnknownTypeChecker = struct {
},
.fn_decl => |fd| {
// A function NAME is a binding site too: a bare reserved-name
// `s2 :: (…) {…}` (free fn or struct/impl method) is rejected,
// exactly like `s2 := …`. Backtick (`` `s2 :: … ``) and
// `i2 :: (…) {…}` (free fn or struct/impl method) is rejected,
// exactly like `i2 := …`. Backtick (`` `i2 :: … ``) and
// `#import c` foreign fns set `is_raw` and are exempt (0089).
self.checkBindingName(fd.name, fd.name_span, fd.is_raw);
self.checkParamNames(fd.params);
@@ -366,7 +366,7 @@ pub const UnknownTypeChecker = struct {
/// (a lambda default), so recurse into it.
fn checkParamNames(self: UnknownTypeChecker, params: []const ast.Param) void {
for (params) |p| {
// A backtick raw param (`` (`s2: T) ``) or a `#import c` foreign
// A backtick raw param (`` (`i2: T) ``) or a `#import c` foreign
// param is exempt from the reserved-type-name rule —
// the exemption is honored inside `checkBindingName` via `p.is_raw`.
self.checkBindingName(p.name, p.name_span, p.is_raw);
@@ -721,7 +721,7 @@ pub const UnknownTypeChecker = struct {
/// struct template's value-param positions come from its declared params; a
/// type-RETURNING function (`Make :: ($K: u32, $T: Type) -> Type`) classifies
/// each param from its constraint, mirroring `instantiateTypeFunction` — so
/// `Make(N, s64)` (N a module const) is not walked as the type name "N".
/// `Make(N, i64)` (N a module const) is not walked as the type name "N".
fn isValueParamPosition(self: UnknownTypeChecker, base: []const u8, i: usize) bool {
if (std.mem.eql(u8, base, "Vector")) return i == 0;
if (self.index.struct_template_map.get(base)) |tmpl| {
@@ -812,11 +812,11 @@ pub const UnknownTypeChecker = struct {
// Only bare identifiers are validated. Inline-spelled compound types
// (`[:0]u8`, `mod.Type`, …) carry non-identifier characters — trust them.
if (!isIdentLike(name)) return;
// A backtick raw reference (`` `s2 ``) is the LITERAL name used as a
// A backtick raw reference (`` `i2 ``) is the LITERAL name used as a
// type — explicitly NOT the builtin/reserved spelling — so it must
// resolve to a `` `s2 ``-declared type, else a normal "unknown type"
// resolve to a `` `i2 ``-declared type, else a normal "unknown type"
// error. Skip the builtin-name exemption that would otherwise wave a
// bare `s2` through.
// bare `i2` through.
if (!is_raw and isBuiltinTypeName(name)) return;
for (in_scope) |tp| {
if (!std.mem.eql(u8, tp.name, name)) continue;
@@ -891,7 +891,7 @@ pub const UnknownTypeChecker = struct {
/// is that classifier (`parser.zig` uses it to choose `.type_expr` over
/// `.identifier`), so deferring to it ties the rejection to the parser's set and
/// keeps the two from drifting: the named builtins (`bool`, `string`, `void`,
/// `f32`, `f64`, `usize`, `isize`, `Any`) and the `[su]N` arbitrary-width ints
/// `f32`, `f64`, `usize`, `isize`, `Any`) and the `[iu]N` arbitrary-width ints
/// over sx's supported 164 range. A bare value name (`s`, `buf`, `index`,
/// `self`) is not a type spelling and is left alone.
fn isReservedTypeName(name: []const u8) bool {
@@ -900,8 +900,8 @@ fn isReservedTypeName(name: []const u8) bool {
fn isBuiltinTypeName(name: []const u8) bool {
if (TypeResolver.resolvePrimitive(name) != null) return true;
// Arbitrary-width integers / floats: u1, s7, u128, f16, f80, …
if (name.len >= 2 and (name[0] == 'u' or name[0] == 's' or name[0] == 'f')) {
// Arbitrary-width integers / floats: u1, i7, u128, f16, f80, …
if (name.len >= 2 and (name[0] == 'u' or name[0] == 'i' or name[0] == 'f')) {
var all_digits = true;
for (name[1..]) |c| {
if (!std.ascii.isDigit(c)) {
@@ -918,7 +918,7 @@ fn isBuiltinTypeName(name: []const u8) bool {
/// True when a `const_decl`'s value introduces a TYPE name — a type declaration
/// (`struct`/`enum`/`union`/`error`) or a type-expression alias (`Alias :: u32`,
/// `Ptr :: *u8`, `Cb :: (s32) -> s32`, …). Only these belong in the declared-
/// `Ptr :: *u8`, `Cb :: (i32) -> i32`, …). Only these belong in the declared-
/// type-name set; a value const (`NotAType :: 123`) does NOT declare a type and
/// must stay subject to the unknown-type check.
///