Files
sx/examples/0822-route-all-own-wins-surfaces.sx
agra d8076b9333 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.
2026-06-12 09:31:53 +03:00

40 lines
1.3 KiB
Plaintext

// G3 — own-wins HALVES for the route-all surfaces 0815 covered only on the
// ambiguous half. `main` authors its OWN `Box { m }` and flat-imports `dep.sx`
// (`Box { a }`); each surface below must bind main's OWN `Box`, observed by a
// `.m` access (disjoint field sets → a wrong-author binding is a hard compile
// error). Complements 0816 (which covered only the union body-builder child):
// - pointer wrapper-alias element `BoxPtr :: *Box`
// - tuple element `(Box, i32)`
// - enum body-builder child `WrapE :: enum { V: Box }`
// - inline-anonymous union child `x : union { b: Box }`
#import "modules/std.sx";
#import "0822-route-all-own-wins-surfaces/dep.sx";
Box :: struct { m: i32; }
BoxPtr :: *Box;
WrapE :: enum { V: Box; }
main :: () -> i32 {
own : Box = ---;
own.m = 10;
// *Named wrapper-alias element own-wins
bp : BoxPtr = @own;
// tuple element own-wins
t : (Box, i32) = ---;
t.0.m = 12;
// enum body-builder child own-wins (payload must be main's `Box`)
we : WrapE = .V(own);
ev := we.V.m;
// inline-anonymous union child own-wins
x : union { b: Box; n: i32 } = ---;
x.b.m = 13;
print("bp={} t={} ev={} x={} dep={}\n", bp.m, t.0.m, ev, x.b.m, dep_box());
0
}