✗
Failing This test is currently failing.
Failed: js-runtime
Failure Output
🎯 Compiler coordination: Passes: 14 (flow-based: frontend, analysis, emission) Code
// ~if template cross-target: its body lowers to `if(){}else{}`, valid in BOTH
// targets — so the template works on JS (unlike ~for, whose Zig for-loop syntax
// doesn't). Uses a literal condition to avoid the separate host-const-emission
// bug (see 140_010). PASSING here = templates are NOT Zig-only.
~import std/io
~if(42 > 10)
| then |> std/io:print("big\n")
| else |> std/io:print("small\n")
Actual · Zig
✓ passbig
Actual · JavaScript
✗ js-runtime/Users/larsde/src/koru/tests/regression/100_MODULE_SYSTEM/140_FILE_LAYOUT/140_015_if_template_cross_target/output_emitted.js:4
{ main_module.impl_event.handler({ expr: "big\n" });
^
TypeError: Cannot read properties of undefined (reading 'handler')
at Object.flow0 (/Users/larsde/src/koru/tests/regression/100_MODULE_SYSTEM/140_FILE_LAYOUT/140_015_if_template_cross_target/output_emitted.js:4:40)
at Object.<anonymous> (/Users/larsde/src/koru/tests/regression/100_MODULE_SYSTEM/140_FILE_LAYOUT/140_015_if_template_cross_target/output_emitted.js:12:13)
at Module._compile (node:internal/modules/cjs/loader:1829:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1969:10)
at Module.load (node:internal/modules/cjs/loader:1552:32)
at Module._load (node:internal/modules/cjs/loader:1354:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
at node:internal/main/run_main_module:33:47
Node.js v25.9.0
Expected output
✓ Zig✗ JavaScriptbig
Emitted JavaScript source
const main_module = {
flow0() {
if (42 > 10) {
{ main_module.impl_event.handler({ expr: "big\n" });
}
} else {
{ main_module.impl_event.handler({ expr: "small\n" });
}
}
},
};
main_module.flow0();
Test Configuration
MUST_RUN