✓
Passing Passing: the compiler rejects this program as expected.
Code
// std/channel — a chain step naming a channel nobody declared refuses by
// name and spells the declaration.
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 }
mk-reading(i: 1, t: 1.0): r |> std/channel:send(ghost, r)
| ok |> std/io:print.ln("sent")
| full |> std/io:print.ln("full")
| closed |> std/io:print.ln("closed")
Actual compiler output
error[KORU161]: std/channel:send: no channel named 'ghost' — `std/channel:new(ghost, capacity: N) { kind: Proto }` declares it
--> tests/regression/600_STDLIB/699_CHANNEL/699_009_send_unknown_channel/input.k:15: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 ~mk-reading click a branch to expand · @labels scroll to their anchor
mk-reading (i: 1, t: 1.0)
Test Configuration
MUST_ERROR