// A caller-owned helper passed as a comptime-ONLY `$`-arg to a NAMESPACED // imported metaprogram resolves in the CALLER's visibility context — not the // metaprogram's defining module (regression, issue 0106 follow-up). // // `emit` is reachable only as `m.emit`; the comptime arg `caller_name()` is // authored HERE in the caller. When `emit` splices that arg into its `#insert` // body and lowers it, the bare name `caller_name` must stay visible in the // caller's context. Before the fix, the body's defining-module pin also covered // the substituted caller arg, so `caller_name` was wrongly checked against // `emit.sx` and rejected as "not visible". The metaprogram's OWN code still // resolves in `emit.sx` (where `concat`/`print` are flat-imported), so this // stays compatible with the 0106 defining-context pin. // // Comptime-ONLY: `caller_name()` is evaluated at compile time and its value is // embedded as a literal in the generated `print(...)` statement — it is never // materialized at runtime (so this does NOT exercise issue 0107). m :: #import "0738-modules-comptime-arg-caller-context/emit.sx"; caller_name :: () -> string { return "world"; } main :: () -> i32 { m.emit(caller_name()); return 0; }