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.
24 lines
717 B
Plaintext
24 lines
717 B
Plaintext
// Step 2.7 — forwarding a variadic to a `[]Any` helper.
|
|
//
|
|
// A comptime pack `..$args` is comptime-only (Decision 1): `args` bare is NOT a
|
|
// runtime value, so `log_count(args)` on a pack is an error (see the
|
|
// pack-as-value tests). To forward a variadic to a runtime `[]Any` helper,
|
|
// declare it as the *slice* variadic `..args: []Any` — then `args` is a real
|
|
// `[]Any` slice that passes straight through.
|
|
|
|
#import "modules/std.sx";
|
|
|
|
log_count :: (items: []Any) -> i64 {
|
|
return items.len;
|
|
}
|
|
|
|
// Slice variadic: `args` is a runtime []Any, forwarded directly.
|
|
forward :: (..args: []Any) -> i64 {
|
|
return log_count(args);
|
|
}
|
|
|
|
main :: () -> i32 {
|
|
print("{}\n", forward(1, "hi", 2.5));
|
|
return 0;
|
|
}
|