Repository navigation
Description
Summary
Add missing edge-case tests for select await: zero arms and refutable branch patterns. Core select behavior has positive tests, but the requirement campaign found that the explicit negative rules are not covered. These tests protect the parser/sema boundary and make §14.10 diagnostics stable.
Spec
§14.10 requires at least one select await branch. Branch patterns are irrefutable bindings; refutable matching belongs inside the branch body.
select await:
value = task => use(value) // ok
select await:
Some(value) = task => value // error: refutable pattern
Current state
Sema rejects zero arms (src/SemaCheck.w:3353, src/SemaCheck.w:3357) and checks each branch task is awaitable (src/SemaCheck.w:3362, src/SemaCheck.w:3368). Parser lowering handles select branches in Parser.parse_select_await (src/Parser.w:4991). Existing positive tests cover branch selection, break, ?, fair and biased modes (test/spec/spec_ss14_9_select_await.w:16, test/spec/spec_ss14_10_fair_select_await.w:12).
There is no compile-error test proving zero-arm select or refutable branch patterns fail.
Implementation plan
- Add
test/compile_errors/err_select_await_zero_arms.wwith an empty braced or colon form and//! expect-error: select await requires at least one arm. - Add
test/compile_errors/err_select_await_refutable_pattern.wusing a branch pattern such asSome(x) = task => .... - If the parser cannot currently represent refutable branch patterns, make the test assert the parser diagnostic. If it parses but sema accepts it, add a sema check that the branch binder is an identifier/irrefutable binding only.
- Keep existing positive
select awaitbehavior tests unchanged.
Test plan
Run the two new compile-error tests plus existing select tests:
test/spec/spec_ss14_9_select_await.w;test/spec/spec_ss14_10_fair_select_await.w;test/behavior/behav_async_select.w;test/behavior/behav_async_select_completed_loser_await.w.
Acceptance criteria
- Zero-branch
select awaithas a compile-error fixture. - Refutable branch pattern rejection has a compile-error fixture.
- Positive select await tests continue to pass.
with build && with build :fixpoint && with build :testpass.
Dependencies
None.
Traceability
From the requirements campaign (docs/requirements.md, spec v7.1). Affected requirement IDs: 14.10.1.15, 14.10.1.16.
Activity
ehartford commentedon Jul 3, 2026
Closing — select await with zero arms rejected, pinned by err_select_await_zero_arms (13f4f88). §14. Note: a refutable branch pattern is rejected only incidentally (generic parse error, no dedicated diagnostic) — surfaced for a possible diagnostic improvement, not pinned.
test: coverage-sweep batch 4 (#497 #504 #506 #524 #525 #531 #534)