Files
sx/examples/0739-modules-comptime-pack-arg-caller-context.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

26 lines
1.3 KiB
Plaintext

// Caller-owned helpers passed as VARIADIC comptime-pack args (`..$args`) to a
// NAMESPACED imported metaprogram resolve in the CALLER's visibility context —
// not the metaprogram's defining module (regression, issue 0106 follow-up).
//
// `std.print :: ($fmt: string, ..$args)` is authored in `std.sx`; the pack args
// `caller_num()` / `caller_two()` are authored HERE in the caller. The body's
// typed `args[i]` substitution (via packArgNodeAt) lowers each pack arg under
// the metaprogram's defining-module pin, so without stamping the pack-arg nodes
// with the caller's source, the bare names `caller_num` / `caller_two` were
// wrongly checked against `std.sx` and rejected as "not visible". The fixed
// comptime param (`$fmt`) already got this treatment; this extends it to every
// node in the variadic pack. The metaprogram's OWN code (build_format / out)
// still resolves in `std.sx`, so the defining-context pin stays intact.
//
// Two pack positions lock that EVERY pack arg is stamped, not just the first.
// i64 values only — accepted by print at runtime today (no 0107/0108 coupling).
std :: #import "modules/std.sx";
caller_num :: () -> i64 { return 42; }
caller_two :: () -> i64 { return 7; }
main :: () -> i32 {
std.print("{} {}\n", caller_num(), caller_two());
return 0;
}