test: group examples into per-category folders
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.
This commit is contained in:
32
examples/comptime/0603-comptime-interp-variadic-any.sx
Normal file
32
examples/comptime/0603-comptime-interp-variadic-any.sx
Normal file
@@ -0,0 +1,32 @@
|
||||
// IR interpreter — variadic `..Any` indexing inside post-link callback.
|
||||
//
|
||||
// `format(fmt, ..args: []Any)` lowers to `any_to_string(args[i])` calls.
|
||||
// The interpreter must be able to read every element of the packed
|
||||
// `[N x Any]` slice from within a `#run`/post-link callback, not just
|
||||
// the first two — and not just via JIT.
|
||||
|
||||
#import "modules/std.sx";
|
||||
#import "modules/build.sx";
|
||||
|
||||
puts :: (s: [:0]u8) -> i32 extern libc;
|
||||
|
||||
cb :: (opt: BuildOptions) -> bool abi(.compiler) {
|
||||
a := format("{}", "x");
|
||||
puts("1-arg ok");
|
||||
b := format("{} {}", "x", "y");
|
||||
puts("2-arg ok");
|
||||
c := format("{} {} {}", "x", "y", "z");
|
||||
puts("3-arg ok");
|
||||
true
|
||||
}
|
||||
|
||||
// The registrar is itself compiler-domain (`abi(.compiler)`): it runs in the
|
||||
// comptime evaluator (never the binary), so its `build_options()` /
|
||||
// `set_post_link_callback()` compiler-API calls are permitted.
|
||||
configure :: () abi(.compiler) {
|
||||
opts := build_options();
|
||||
on_build(cb);
|
||||
}
|
||||
#run configure();
|
||||
|
||||
main :: () { print("rt\n"); }
|
||||
Reference in New Issue
Block a user