lang 1.1: parse pack-constrained variadic parameter
`..xs: Protocol` (a bare protocol, no `[]`, no `$`) on a variadic parameter now parses to `ast.Param.is_pack = true` — a heterogeneous protocol-constrained pack, distinct from a slice variadic (`..xs: []T`, is_pack=false) and the comptime type-pack (`..$args`, is_comptime=true). Parser-only: sema/lowering for the pack form land in Phase 2; existing forms are unaffected (zero examples used a bare non-slice variadic annotation). Adds three parser unit tests and examples/probes/pack-param-parses.sx.
This commit is contained in:
@@ -127,6 +127,12 @@ pub const Param = struct {
|
||||
type_expr: *Node,
|
||||
is_variadic: bool = false,
|
||||
is_comptime: bool = false,
|
||||
/// Heterogeneous protocol-constrained variadic pack: `..xs: Protocol`
|
||||
/// (no `[]`, no `$`). The annotation is a bare protocol the trailing args
|
||||
/// each conform to with their own type-arg — distinct from a slice variadic
|
||||
/// (`..xs: []T`, `is_pack == false`) and from the comptime type-pack
|
||||
/// (`..$xs`, `is_comptime == true`). Always implies `is_variadic`.
|
||||
is_pack: bool = false,
|
||||
/// Optional default value expression. When the caller omits this
|
||||
/// parameter, lowering substitutes this expression in its place.
|
||||
default_expr: ?*Node = null,
|
||||
|
||||
Reference in New Issue
Block a user