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.
22 lines
817 B
Plaintext
22 lines
817 B
Plaintext
// Variadic heterogeneous type packs — step 3 complex smoke.
|
|
//
|
|
// Three-element pack with `$args[2]` (the third element) used in
|
|
// the return-type position. Confirms:
|
|
// - Multi-arg packs index past the zeroth element correctly.
|
|
// - Three distinct call shapes get three distinct monos.
|
|
// - The return-type slot is correctly substituted per-mono so
|
|
// the inferred caller type matches what the body actually
|
|
// returns (string / i64 / bool here).
|
|
|
|
#import "modules/std.sx";
|
|
|
|
third :: (..$args) -> $args[2] => args[2];
|
|
|
|
main :: () -> i32 {
|
|
a := third(1, 2, "third"); // (i64, i64, string) → "third"
|
|
b := third(true, 3.14, 99); // (bool, f64, i64) → 99
|
|
c := third("a", "b", false); // (string, string, bool) → false
|
|
print("{} {} {}\n", a, b, c);
|
|
return 0;
|
|
}
|