// 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 / s64 / bool here).

#import "modules/std.sx";

third :: (..$args) -> $args[2] => args[2];

main :: () -> s32 {
    a := third(1, 2, "third");          // (s64, s64, string) → "third"
    b := third(true, 3.14, 99);          // (bool, f64, s64) → 99
    c := third("a", "b", false);         // (string, string, bool) → false
    print("{} {} {}\n", a, b, c);
    return 0;
}
