✓
Passing This code compiles and runs correctly.
Code
// std/channel — a send after close lands `| closed`, not `| ok`.
import std/io
import std/proto
import std/channel
std/proto(Reading) {
id: u64
ts: f64
}
pub tor mk-reading { i: u64, t: f64 } -> Reading
mk-reading -> { id: i, ts: t }
std/channel:new(inbox, capacity: 4) { reading: Reading }
std/channel:close(inbox)
| ok |> mk-reading(i: 5, t: 5.0): r |> std/channel:send(inbox, r)
| ok |> std/io:print.ln("send ok")
| full |> std/io:print.ln("send full")
| closed |> std/io:print.ln("send refused: closed")
Actual
send refused: closed
Expected output
send refused: closed
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: inbox, capacity: 4, source: reading: Reading)
flow ~close click a branch to expand · @labels scroll to their anchor
close (expr: inbox)
Test Configuration
MUST_RUN