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

@@ -7,15 +7,15 @@
> so a pointer-to-`.unresolved` reached LLVM emission and tripped the
> `src/backend/llvm/types.zig` tripwire. The nested lvalue-pointer path
> (`Lowering.lowerExprAsPtr`'s `.field_access` fallback) had the sibling defect:
> on a miss it returned `structGepTyped(obj_ptr, 0, .s64, obj_ty)` — a silent
> field-0/`.s64` default.
> on a miss it returned `structGepTyped(obj_ptr, 0, .i64, obj_ty)` — a silent
> field-0/`.i64` default.
>
> **Fix (`src/ir/lower.zig`):** all three lvalue field-store sites — single
> assignment, address-of, and multi-target assignment — route field resolution
> through one shared helper, `fieldLvaluePtr(obj_ptr, obj_ty, field)`, which
> resolves struct fields, union/tagged-union direct fields, promoted
> anonymous-struct union members, tuple elements, and vector lanes (reusing
> `vectorLaneIndex`), and returns `null` (no field 0 / `.unresolved` /`.s64`
> `vectorLaneIndex`), and returns `null` (no field 0 / `.unresolved` /`.i64`
> default) when nothing matches. Each caller emits the read path's
> field-not-found diagnostic (`emitFieldError`) on a `null` result:
> 1. `lowerAssignment` `.field_access` target — delegates to `fieldLvaluePtr`;
@@ -23,7 +23,7 @@
> deleted (issue-0083 two-resolver divergence removed).
> 2. `lowerExprAsPtr` `.field_access` — delegates to `fieldLvaluePtr`, so the
> address-of path resolves promoted union members (`@v.x`) — not only direct
> union fields — and a genuine miss errors. The `.s64` sentinel is gone.
> union fields — and a genuine miss errors. The `.i64` sentinel is gone.
> 3. `lowerMultiAssign` `.field_access` target — replaced its struct-only loop
> (which defaulted `field_idx 0` / `field_ty .unresolved` on a miss, silently
> storing into field 0 — `p.q, y = 2, 3` printed `x=2 y=3`) with the shared
@@ -65,7 +65,7 @@ Expected: a normal compile error like `field 'q' not found on type 'Point'`, mat
## Reproduction
```sx
Point :: struct { x: s64; }
Point :: struct { x: i64; }
main :: () {
p := Point.{ x = 1 };
@@ -81,6 +81,6 @@ panic: unresolved type reached LLVM emission — a type resolution failure was n
## Investigation prompt
Fix issue 0094 in the sx compiler: assigning to a missing struct field (`p.q = 2`) panics with `.unresolved` reaching LLVM emission instead of emitting a field-not-found diagnostic.
Suspected area: `src/ir/lower.zig`, especially `Lowering.lowerAssignment`'s `.field_access` target path around the struct-field lookup (`field_ty` starts as `.unresolved`, no matched field diagnoses, then `ptrTo(field_ty)` is stored) and the related `Lowering.lowerExprAsPtr` field-access fallback that returns `structGepTyped(obj_ptr, 0, .s64, obj_ty)` on lookup failure. The fix should make failed lvalue field lookup loud, reusing `emitFieldError(obj_ty, field, span)` or equivalent, and should not use `.s64`, `.void`, or any real type as a sentinel.
Suspected area: `src/ir/lower.zig`, especially `Lowering.lowerAssignment`'s `.field_access` target path around the struct-field lookup (`field_ty` starts as `.unresolved`, no matched field diagnoses, then `ptrTo(field_ty)` is stored) and the related `Lowering.lowerExprAsPtr` field-access fallback that returns `structGepTyped(obj_ptr, 0, .i64, obj_ty)` on lookup failure. The fix should make failed lvalue field lookup loud, reusing `emitFieldError(obj_ty, field, span)` or equivalent, and should not use `.i64`, `.void`, or any real type as a sentinel.
Verification: run the repro and expect exit 1 with a source diagnostic `field 'q' not found on type 'Point'`; no LLVM panic. Then run `zig build`, `zig build test`, and `bash tests/run_examples.sh`.