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:
12
CLAUDE.md
12
CLAUDE.md
@@ -73,9 +73,9 @@ There is no "wrap up first" option.
|
||||
a lookup fails in the compiler. Examples of the pattern to root out:
|
||||
|
||||
```zig
|
||||
// NEVER write this — lookup fails, return s64 and pretend nothing
|
||||
// NEVER write this — lookup fails, return i64 and pretend nothing
|
||||
// happened. Any caller asking `what type is this?` gets a lie.
|
||||
return self.module.types.findByName(name_id) orelse .s64;
|
||||
return self.module.types.findByName(name_id) orelse .i64;
|
||||
|
||||
// NEVER write this — same shape, dressed up:
|
||||
return scope.lookup(name) orelse default_type;
|
||||
@@ -86,9 +86,9 @@ These defaults silently produce wrong results in cases the implementer
|
||||
didn't think of. The classic failure mode: the default coincidentally
|
||||
matches the size/shape of one common case, so the test suite passes
|
||||
and the bug ships invisibly. issue-0042 lived for years because
|
||||
`resolveTypeArg`'s `orelse .s64` returned 8 bytes for unresolved
|
||||
`resolveTypeArg`'s `orelse .i64` returned 8 bytes for unresolved
|
||||
type-alias names — coincidentally correct for any 8-byte target
|
||||
(`s64`, `*T`, `f64`, function pointers), and silently wrong for
|
||||
(`i64`, `*T`, `f64`, function pointers), and silently wrong for
|
||||
everything else.
|
||||
|
||||
✅ **Required:** when a lookup that *must* succeed fails, emit a
|
||||
@@ -102,7 +102,7 @@ as a silently-corrupted size or alignment.
|
||||
`void` is a real, heavily-checked type (void returns, void params, "no
|
||||
value" markers), and pervasive `if (ty == .void) { skip / return-nothing }`
|
||||
checks would silently swallow the failure — trading one silent default
|
||||
(`.s64`) for another (`.void`) one layer down. The same objection rules
|
||||
(`.i64`) for another (`.void`) one layer down. The same objection rules
|
||||
out `noreturn` (diverging expressions) and any other load-bearing builtin.
|
||||
Instead, add a **distinct** `.unresolved`-style `TypeId` whose sole meaning
|
||||
is "resolution failed". A dedicated value (1) can't be mistaken for a real
|
||||
@@ -311,7 +311,7 @@ LongLived :: struct {
|
||||
}
|
||||
|
||||
// Direct allocs too:
|
||||
grow_buf :: (self: *LongLived, n: s64) {
|
||||
grow_buf :: (self: *LongLived, n: i64) {
|
||||
self.buf = self.own_allocator.alloc(n);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user