✓
Passing Passing: the compiler rejects this program as expected.
Code
// std/channel — `capacity: 0` is refused, loudly. Rendezvous (a send that
// parks until a consumer takes) is the deferred-resume frontier named in
// docs/CHANNEL.md — buffered channels only, so the declaration says so
// rather than silently minting a channel that can never buffer.
import std/proto
import std/channel
std/proto(Reading) {
id: u64
ts: f64
}
std/channel:new(bad, capacity: 0) { reading: Reading }
Actual compiler output
error[KORU161]: std/channel:new(bad): capacity 0 is rendezvous — a send whose ok fires on the consumer's take — and that spelling is deferred (docs/CHANNEL.md). Buffered channels take a power of two above zero
--> tests/regression/600_STDLIB/699_CHANNEL/699_008_capacity_zero_refused/input.k:13:0Compiler must reject:
Compilation must fail with a diagnostic.
Flows
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Reading, source: id: u64
ts: f64)
flow ~new click a branch to expand · @labels scroll to their anchor
new (expr: bad, capacity: 0, source: reading: Reading)
Test Configuration
MUST_ERROR