Move examples/*.sx and their expected/ snapshots into per-category subfolders (examples/<category>/...). Folder = leading filename token, with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus runner and LSP sweep now discover each category's expected/ dir, while issues/ stays flat. Example 1058's repo-root-relative companion import is made file-relative. Path strings embedded in 164 snapshots were regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
25 lines
1.2 KiB
Plaintext
25 lines
1.2 KiB
Plaintext
// 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;
|
|
}
|