//META: generated=true
//META: model=claude-opus-5[1m]
//META: generated_at=2026-08-04T00:00:00+00:00
//META: source_commit=7e725f15572c6589ee6d738a8856fb3348f11617
//META: doc_ref=docs/generated/design/pipeline/02-parse-ast.md#generics-ambiguity
//META: doc_section_digest=eb0fd6263e6c05fcda56c26f5dbe0c80c738c9165b8bfd51abc3dc4235097f39
//META: purpose=The `where countof(Pack) == IntExpr` spelling parses into a pack-count constraint that a call with the matching pack arity satisfies.
//META: intent=functional
//META: pipeline_stage=parse
//META: warning=Auto-generated. May drift from source. Do not edit by hand.

// Verifies the documented one-sided pack-count spelling with
// `countof(...)` on the left. The generic requires exactly N pack
// elements; the explicit specialization `<2>` with a two-element pack
// satisfies the constraint and the sum is printed, proving the
// constraint parsed and solved.

//TEST:INTERPRET(filecheck=CHECK):

int sumExactly<let N : int, each T>(expand each T args) where countof(T) == N where T == int
{
    int total = 0;
    expand(total = total + (each args));
    return total;
}

void main()
{
    // CHECK: sum=11
    printf("sum=%d\n", sumExactly<2>(4, 7));
}
