Repository navigation
Description
Summary
Add missing negative coverage for partial application placeholders. Positive partial application exists, but errors for invalid placeholder positions and placeholder-only contexts need tests so the syntax remains explicit and predictable.
Spec
§9.4 says _ is a placeholder only inside a call argument list, placeholder calls produce closures in left-to-right placeholder order, _ in callee position is an error, and add(5) is a normal wrong-argument-count error rather than implicit currying (docs/with-specification.md:3343-3372).
Current state
Parser.parse_call counts _ identifiers in call arguments, replaces them with generated closure parameters, and wraps the call in NK_CLOSURE when placeholders are present (src/Parser.w:4063-4102). test/behavior/behav_partial_app.w covers basic positive cases. The requirements campaign notes missing negative tests for _ outside a call argument list and _ in callee position (out/req-campaign/g04.tsv:97, out/req-campaign/g04.tsv:100).
Implementation plan
- Add compile-error tests for
_as a standalone expression and_in callee position. - Add a wrong-argument-count test proving
add(5)does not produce a partial application. - Add a test for multiple placeholders preserving left-to-right order if not already explicit.
- Keep placeholder+named rejection in Named-args rule gaps: implicit+default rejection, placeholder+named rejection (§9.1a, §9.4) #456 because that is an implementation gap, not test-only coverage today.
Test plan
Add test/compile_errors/err_partial_placeholder_standalone.w:
let f = _
expect a placeholder/discard-context diagnostic.
Add test/compile_errors/err_partial_placeholder_callee.w:
_(1)
expect _ in callee position or the current equivalent diagnostic.
Add test/compile_errors/err_partial_missing_arg_not_currying.w:
fn add(a: i32, b: i32) -> i32: a + b
let f = add(5)
expect wrong argument count.
Extend test/behavior/behav_partial_app.w with make_pair(_, 10, _).
Acceptance criteria
- Invalid placeholder positions have compile-error coverage.
- Missing non-placeholder arguments still produce wrong-argument-count errors.
- Positive partial application behavior remains covered.
with build && with build :fixpoint && with build :testpass.
Dependencies
#456 for placeholder+named rejection.
Traceability
From the requirements campaign (docs/requirements.md, spec v7.1). Affected requirement IDs: 9.4.1.4, 9.4.1.7.
Activity
ehartford commentedon Jul 3, 2026
Closing — partial application: missing-arg-is-not-currying rejection (err_partial_missing_arg_not_currying) + placeholder positional coverage pinned (bfe7865); placeholder+named already covered. Note: bare
let f = _/_(1)are rejected with the generic 'undefined variable' (correct rejection; a placeholder-specific message would be a nice-to-have, not a bug). §9.Fix #530 tailrec verifier + coverage-sweep batch 3 (#498 #508 #517 #523