✗
Failing This test is currently failing.
Failed: backend-exec
Error Details
output_emitted.zig:42:22: error: division with 'i64' and 'comptime_int': signed integers must use @divTrunc, @divFloor, or @divExact
Failure Output
🎯 Compiler coordination: Passes: 19 (flow-based: frontend, analysis, emission)
Error: output_emitted.zig:42:22: error: division with 'i64' and 'comptime_int': signed integers must use @divTrunc, @divFloor, or @divExact
return n / 2;
~~^~~
referenced by:
handler [inlined]: output_emitted.zig:36:39
__koru_handler_impl: output_emitted.zig:59:55
5 reference(s) hidden; use '-freference-trace=7' to see all references Code
// RED BY DESIGN (pinned 2026-07-25). `/` and `%` on a SIGNED runtime operand
// emit bare Zig `/` and `%`, which Zig rejects:
//
// error: division with 'i64' and 'comptime_int': signed integers must use
// @divTrunc, @divFloor, or @divExact
//
// A raw host error, not a koru diagnostic — the wall is not built here yet.
//
// SHOWN 2026-07-25, characterised: signed `/` fails, signed `%` fails, UNSIGNED
// `/` works (usize prints 5), signed `*` works. So it is specific to signed
// division and remainder, not arithmetic generally.
//
// Why it survived: koru's own COMPTIME evaluator already gets this right —
// src/comptime_eval.zig uses @divTrunc/@rem and its comment calls that "the
// C-parity choice". The runtime emitter has no matching lowering, and the
// corpus has zero tests dividing a signed runtime value (everything divides
// literals, which const-fold, or divides usize). Comptime and runtime disagree
// about the same operator.
//
// Found from the outside: building a multi-file ledger app in koru-examples,
// where `cents / 100` compiled while the entry passed a literal and broke the
// moment a second module passed the value through at runtime.
//
// Fix direction (unruled): emit @divTrunc/@rem for signed operands, matching
// comptime_eval's C-parity choice, or reject with a koru-level diagnostic that
// names the operand signedness. Either beats leaking Zig's builtin list.
import std/io
pub tor f { n: i64 } -> i64
f -> n / 2
pub tor go { n: i64 } -> i64
go = f(n): h -> h
go(n: 10): x |> std/io:print.ln("half={{ x:d }}")
Expected output
half=5
Flows
subflow ~go click a branch to expand · @labels scroll to their anchor
f (n)
flow ~go click a branch to expand · @labels scroll to their anchor
go (n: 10)
Test Configuration
MUST_RUN