First slice of the `..$args` (variadic heterogeneous type pack)
feature. Locks in the current parser-rejection behavior so the
next commit's parser extension shows up as a behavior shift.
`examples/150-pack-parse.sx` declares `foo :: (..$args) -> s64`.
Today's parser hits `..` where it expects a parameter name
(parseParams in src/parser.zig:1558 only handles `..` inside the
type position after a colon) and emits "expected parameter name".
Expected output captures this rejection.
Per FFI cadence rule, this is the "test fails today, passes after
next commit's parser change" pair.
Pack feature plan saved at
~/.claude/plans/lets-see-options-for-merry-dijkstra.md ("Variadic
heterogeneous type packs" section). Motivates replacing the
hand-rolled per-signature `Into(Block)` impls with one generic
`impl Into(Block) for Closure(..$args) -> $R`; also unlocks
compile-time arity/type errors for `print`/`format`.
191/191 example tests + `zig build test` green.
23 lines
679 B
Plaintext
23 lines
679 B
Plaintext
// Variadic heterogeneous type packs — `..$args` — parse lockin.
|
|
//
|
|
// First slice of the pack feature: the parser does not yet accept
|
|
// `..$args` (variadic-marker + comptime sigil + name, no type
|
|
// annotation). This test pins the current parse-rejection so the
|
|
// next commit's parser change is visible as a behavior shift.
|
|
//
|
|
// Expected next commit: parser accepts `..$args` and this test
|
|
// either flips to a successful parse (compile error from later
|
|
// passes that haven't been wired up yet) or is replaced by a
|
|
// positive test.
|
|
|
|
#import "modules/std.sx";
|
|
|
|
foo :: (..$args) -> s64 {
|
|
return 0;
|
|
}
|
|
|
|
main :: () -> s32 {
|
|
print("never reached\n");
|
|
return 0;
|
|
}
|