lang 1.2: parse pack-expansion forms in all four positions

Pack/tuple spread now parses in tuple-value `(..xs)` / `(..xs.field)`,
tuple-type `(..F(Ts))` / `(..F(Ts.Arg))`, call-arg `f(..xs)` (already),
and closure-sig `Closure(..Ts)` / `Closure(..sources.T)` positions.

Design: the uniform spread node is the existing `spread_expr` (its
operand sub-expression carries the projection `xs.field` and
type-application `F(Ts)` shapes) rather than a new PackExpansion node —
call-arg slice-spread (`..arr`) and pack-spread (`..pack`) are
syntactically identical, so they must share one node, and spread_expr
already serves it with working slice lowering. Closure-sig packs gain
`ClosureTypeExpr.pack_projection` alongside the existing `pack_name`.

Parser-only; sema/lowering land in Phase 2. 6 new parser unit tests +
examples/probes/pack-expansion-parses.sx. Build + 225-suite green.
This commit is contained in:
agra
2026-05-29 12:33:27 +03:00
parent 87f739cef2
commit 98526ab9b4
3 changed files with 161 additions and 1 deletions

View File

@@ -522,6 +522,9 @@ pub const ClosureTypeExpr = struct {
/// `Closure(..$args) -> R` ⇒ pack_name = "args", param_types = [].
/// `Closure(Prefix, ..$args)` ⇒ pack_name = "args", param_types = [Prefix].
pack_name: ?[]const u8 = null,
/// Projection on the pack: `Closure(..sources.T) -> R` ⇒ pack_name =
/// "sources", pack_projection = "T". Null for a bare `..pack`.
pack_projection: ?[]const u8 = null,
};
pub const TupleTypeExpr = struct {