✓
Passing Passing: the compiler rejects this program as expected.
Code
// std/channel — the declaration precedes its uses in document order. A join
// above `std/channel:new` refuses with the ordering law, not an unknown
// channel.
import std/io
import std/proto
import std/channel
std/proto(Reading) {
id: u64
}
std/channel(inbox)
! reading v |> std/io:print.ln("{{ v.id:d }}")
std/channel:new(inbox, capacity: 8) { reading: Reading }
Actual compiler output
error[KORU161]: std/channel(inbox): the join precedes its channel's declaration in source — declare the channel first (rung-one ordering)
--> tests/regression/600_STDLIB/699_CHANNEL/699_015_join_before_decl_refused/input.k:12: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)
flow ~std/channel click a branch to expand · @labels scroll to their anchor
std/channel (inbox)
flow ~new click a branch to expand · @labels scroll to their anchor
new (expr: inbox, capacity: 8, source: reading: Reading)
Test Configuration
MUST_ERROR