✓
Passing Passing: the compiler rejects this program as expected.
Code
// 696_007 — a callee cloned under a ctx scope is a template: its original
// impl is consumed by specialization and its decl is marked [abstract], so
// a bare call to it in a sibling flow (outside any scope) refuses under
// KORU047 rather than silently stubbing to a no-op.
import std/io
import std/store
import std/ctx
std/store:new(inner) { a: 9[i64], b: 8[i64], c: 7[i64] }
pub tor ctxprobe { a: i64, b: i64, c: i64 }
ctxprobe = std/io:print.ln("ctxprobe a={{ a:d }} b={{ b:d }} c={{ c:d }}")
pub tor needs-scope { }
needs-scope = ctxprobe()
std/io:print.ln("seed")
|> std/ctx(inner) |> needs-scope()
std/io:print.ln("bare")
|> needs-scope()
Actual compiler output
error[KORU047]: event 'input:needs-scope' is invoked but has no implementation — without one the compiler would silently stub it to return zero-defaults. Implement it with a proc (`~proc needs-scope|zig { ... }`), a bare-return impl (`~needs-scope -> <value>`), a branch constructor (`~needs-scope => <branch> <value>`), or a subflow (`~needs-scope = <flow>`)
--> tests/regression/600_STDLIB/696_CTX/696_007_ctx_template_bare_refusal/input.k:22:0Must fail at runtime:
Program must error when executed.
Error output must contain
has no implementationFlows
flow ~new click a branch to expand · @labels scroll to their anchor
new (inner, source: a: 9[i64], b: 8[i64], c: 7[i64])
subflow ~ctxprobe click a branch to expand · @labels scroll to their anchor
print.ln (expr: "ctxprobe a={{ a:d }} b={{ b:d }} c={{ c:d }}")
subflow ~needs-scope click a branch to expand · @labels scroll to their anchor
ctxprobe
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "seed")
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "bare")
Test Configuration
MUST_ERROR