✓
Passing Passing: the compiler rejects this program as expected.
Code
// koru/compiler/sqlite — the sqlite diagnostic sink lives in koru-libs'
// compiler toolkit, not stdlib: importing the module IS the subscription AND
// the dep. Its std/compiler:requires links libsqlite3 into the backend build
// and its `std/compiler(diagnostic)` join registers the consumer — a
// compiler plugin shipped as an ordinary package import. Sink settings are a
// module-targeted `X:config` directive (same family as compiler:use, x:new) —
// the custom db-file below proves config crosses the barrier. The pin is the
// row in the configured file.
import koru/compiler/sqlite
koru/compiler/sqlite:config {
db-file: "custom-diag.db"
flush: true
}
totally-bogus()
Actual compiler output
error[KORU040]: unknown tor 'input:totally-bogus'
--> tests/regression/200_COMPILER_FEATURES/220_COMPILATION/220_052_diag_bus_sqlite_sink/input.k:16:1Error output must contain
error[KORU040]: unknown torFlows
flow ~config click a branch to expand · @labels scroll to their anchor
config (source: db-file: "custom-diag.db"
flush: true)
flow ~totally-bogus click a branch to expand · @labels scroll to their anchor
totally-bogus
Test Configuration
MUST_ERROR
Post-validation Script:
#!/bin/bash
# The diagnostic crossed the barrier iff the sink fired — and the X:config
# block crossed it iff the row landed in the CONFIGURED file: custom-diag.db,
# not the builtin default. The refusal on stderr AND the row are the same
# ParseError seen through two consumers. The opt-in dep is also pinned: the
# generated build_backend.zig must carry the sqlite3 link.
set -u
cd "$(dirname "$0")"
fail() { echo "FAIL: $1"; exit 1; }
[ -f custom-diag.db ] || fail "custom-diag.db not produced — :config block did not reach the sink"
grep -q 'sqlite3' build_backend.zig || fail "build_backend.zig missing sqlite3 link requirement"
python3 -c '
import sqlite3
rows = sqlite3.connect("custom-diag.db").execute(
"SELECT code, file, line, col, message, hint FROM diagnostics").fetchall()
assert any(r[0] == "KORU040" and "totally-bogus" in r[4] for r in rows), \
f"no KORU040 row: {rows!r}"
' || fail "KORU040 row missing from custom-diag.db"