✓
Passing Passing: the compiler rejects this program as expected.
Code
// NEGATIVE TEST — orisha:router must reject TERMINAL (`|`) pattern branches.
//
// The router dispatches INTO the matched route — effect semantics — so its
// pattern branches must be effect branches (`!`). The `[GET /path]` bracket
// syntax is just a branch-name escape, orthogonal to `|`/`!` kind. Orisha
// predates `BranchKind` and was kind-blind, silently accepting `| [pattern]`.
// This pins that the transform is now kind-aware and rejects `|` loudly.
~import orisha
~import std/io
const std = @import("std");
const TestRequest = struct {
method: []const u8,
path: []const u8,
};
const req = TestRequest{ .method = "GET", .path = "/" };
// `|` here is WRONG — these are dispatch handlers, must be `!`.
~orisha:router(req: &req)
| [GET /] |> std/io:print.ln("matched GET /")
| [*] |> std/io:print.ln("catch-all")
Actual compiler output
[ROUTER TRANSFORM] Found 2 pattern branches
[ROUTER TRANSFORM] profile: none (orisha.profile absent) — pattern order unchanged
[ROUTER TRANSFORM] Generated inline dispatch:
//@koru:inline_stmt
comptime { @compileError("orisha:router pattern branches must use effect `!`, not terminal `|`. Write `! [GET /path]` instead."); }
🎯 Compiler coordination: Passes: 20 (flow-based: elaborate, analysis, emission)
Error: install
+- install output
+- compile exe output Debug native 1 errors
output_emitted.zig:90:20: error: orisha:router pattern branches must use effect `!`, not terminal `|`. Write `! [GET /path]` instead.
comptime { @compileError("orisha:router pattern branches must use effect `!`, not terminal `|`. Write `! [GET /path]` instead."); }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
main: output_emitted.zig:2312:22
callMain [inlined]: /opt/homebrew/Cellar/zig/0.15.2_1/lib/zig/std/start.zig:618:22
callMainWithArgs [inlined]: /opt/homebrew/Cellar/zig/0.15.2_1/lib/zig/std/start.zig:587:20
main: /opt/homebrew/Cellar/zig/0.15.2_1/lib/zig/std/start.zig:602:28
1 reference(s) hidden; use '-freference-trace=5' to see all references
error: the following command failed with 1 compilation errors:
/opt/homebrew/Cellar/zig/0.15.2_1/bin/zig build-exe -I/opt/homebrew/Cellar/openssl@3/3.6.3/include -L/opt/homebrew/Cellar/openssl@3/3.6.3/lib -lssl -I/opt/homebrew/Cellar/openssl@3/3.6.3/include -L/opt/homebrew/Cellar/openssl@3/3.6.3/lib -lcrypto -ODebug -I /opt/homebrew/opt/openssl@3/include -L /opt/homebrew/opt/openssl@3/lib -Mroot=/Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/350_SUBFLOWS/350_013_orisha_router_rejects_terminal/output_emitted.zig -lc --cache-dir .zig-cache --global-cache-dir /Users/larsde/.cache/zig --name output --zig-lib-dir /opt/homebrew/Cellar/zig/0.15.2_1/lib/zig/ --listen=-
Build Summary: 0/3 steps succeeded; 1 failed
install transitive failure
+- install output transitive failure
+- compile exe output Debug native 1 errors
error: the following build command failed with exit code 1:
.zig-cache/o/567dc43526913819caf023e23bd5b7be/build /opt/homebrew/Cellar/zig/0.15.2_1/bin/zig /opt/homebrew/Cellar/zig/0.15.2_1/lib/zig /Users/larsde/src/koru/tests/regression/300_ADVANCED_FEATURES/350_SUBFLOWS/350_013_orisha_router_rejects_terminal .zig-cache /Users/larsde/.cache/zig --seed 0x778bd933 -Zdc628d2506dbae00 -Doptimize=DebugMust contain:
orisha:router pattern branches must use effectFlows
flow ~router click a branch to expand · @labels scroll to their anchor
router (req: &req)
Test Configuration
MUST_ERROR
koru.json:
{
"name": "router_showcase",
"version": "0.1.0",
"paths": {
"std": "../../../../../koru_std",
"orisha": "../../../../../../orisha/lib"
}
}