Skip to content

A variadic case may state fills T: the case presents the value the callee wrote (closes #3119) - #3632

Merged
ehartford merged 3 commits into
mainfrom
fills-case
Nov 26, 2026
Merged

ehartford merged 3 commits into
mainfrom
fills-case

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Closes #3119. The sentence was blessed by Eric on 2026-11-25 and is in §16.2b.5 since spec v7.90; its status note now says implemented.

What a contract writes.

fn curl_easy_getinfo
    rename getinfo
    lend
    ok CURLE_OK
    variadic param 2 selected by param info:
        case CURLINFO_RESPONSE_CODE: fills c_long

What the program writes. easy.getinfo(CURLINFO_RESPONSE_CODE) is a Result[c_long, GetinfoError]: With passes the address of a zeroed c_long as the variadic argument and presents the value when the call returned its ok.

Rules enforced. T is an integer, a float, or a C record whose all-zero bytes are a value (the rule for fills on a fixed parameter); a pointer is refused with a help line. A function with no ok contract cannot state the case.

Changes. The grammar reads fills before the type; FacadeVariadicKind.Fills; the renderer emits the case as a Result and the operation's error type, for a resource's method and for a free function. A variadic contract with an ok no longer trips the check that expects one bridge function (it renders one per case).

Tests. behav_3119_variadic_case_fills (integer, float, record, a failed call, a method and a free function over a local header); behav_3119_libcurl_getinfo_fills (libcurl's own curl_easy_getinfo); err_3119_fills_case_needs_ok; err_3119_fills_case_pointer. The non-variadic out-parameter the issue also names is fills param N, which exists since D198.

Not covered, as the ruling says. A case that hands back a pointer the library owns (CURLINFO_EFFECTIVE_URL) is not fills and stays raw.

Evidence. Battery GREEN on c35054a; :release-checks green on the same commit; the libcurl test added after it is a test file only and passes.

@ehartford
ehartford enabled auto-merge (squash) November 26, 2026 12:28
@ehartford
ehartford merged commit 1e57851 into main Nov 26, 2026
1 check passed
@ehartford
ehartford deleted the fills-case branch November 26, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Facade grammar: a variadic case that is an out-pointer (curl_easy_getinfo(h, CURLINFO_RESPONSE_CODE, &long)) has no form

1 participant