✓
Passing Passing: the compiler rejects this program as expected.
Code
// TEST: Array literal must target a slice type
//
// Koru array literal syntax ([a, b, c]) is only valid when the target
// parameter is a slice (e.g. []const i32). Using it for a non-slice
// parameter must fail.
~tor take { numbers: i32 }
~proc take|zig {
return .{ .done = {} };
}
~take(numbers: [1, 2, 3])
Actual compiler output
thread 439814621 panic: attempt to unwrap error: ArrayLiteralInvalidTarget
???:?:?: 0x10294a93f in _emitter_helpers.emitArrayLiteralForField (???)
???:?:?: 0x102949d83 in _emitter_helpers.emitArgs (???)
???:?:?: 0x1029518cf in _emitter_helpers.emitInvocation (???)
???:?:?: 0x10298afb7 in _emitter_helpers.emitFlow (???)
???:?:?: 0x1029f4d8b in _visitor_emitter.VisitorEmitter.visitItem (???)
???:?:?: 0x102a11577 in _visitor_emitter.VisitorEmitter.emit (???)
???:?:?: 0x1027d34e7 in _backend_output_emitted.koru_std.koru_compiler.emit_zig_event.handler (???)
???:?:?: 0x1027c9bb3 in _backend_output_emitted.koru_std.koru_compiler.emission_event.handler (???)
???:?:?: 0x1027c807f in _backend_output_emitted.koru_std.koru_compiler.coordinate_event.handler (???)
???:?:?: 0x1027c7d7f in _koru_coordinate (???)
???:?:?: 0x1027453fb in _backend.RuntimeEmitter.emit (???)
???:?:?: 0x102746ef7 in _backend.main (???)
???:?:?: 0x102752207 in _main (???)
???:?:?: 0x1816a3dff in ??? (???)
???:?:?: 0x0 in ??? (???)
/Users/larsde/src/koru/scripts/regression_lib.sh: line 494: 51095 Abort trap: 6 ./backend outputMust contain:
ArrayLiteralInvalidTargetFlows
flow ~take click a branch to expand · @labels scroll to their anchor
take (numbers: [1, 2, 3])
Test Configuration
MUST_ERROR