✓
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 11379288 panic: attempt to unwrap error: ArrayLiteralInvalidTarget
???:?:?: 0x102ef009b in _emitter_helpers.emitArrayLiteralForField (???)
???:?:?: 0x102eef4eb in _emitter_helpers.emitArgs (???)
???:?:?: 0x102efc17b in _emitter_helpers.emitInvocation (???)
???:?:?: 0x102f40b3b in _emitter_helpers.emitFlow (???)
???:?:?: 0x1030f483b in _visitor_emitter.VisitorEmitter.visitItem (???)
???:?:?: 0x103110c5b in _visitor_emitter.VisitorEmitter.emit (???)
???:?:?: 0x102f4b5d7 in _backend_output_emitted.koru_std.koru_compiler.emit_zig_event.handler (???)
???:?:?: 0x102d4a1ab in _backend_output_emitted.koru_std.koru_compiler.emit_zig_artifact_event.handler (???)
???:?:?: 0x102d4022b in _backend_output_emitted.koru_std.koru_compiler.emission_event.handler (???)
???:?:?: 0x102d3e4a3 in _backend_output_emitted.koru_std.koru_compiler.coordinate_event.handler (???)
???:?:?: 0x102d3e1a3 in _koru_coordinate (???)
???:?:?: 0x102cce603 in _backend.RuntimeEmitter.emit (???)
???:?:?: 0x102ccf937 in _backend.main (???)
???:?:?: 0x102cd1a5b in _main (???)
???:?:?: 0x18073fdff in ??? (???)
???:?:?: 0x0 in ??? (???)
/Users/larsde/src/koru/scripts/regression_lib.sh: line 559: 37633 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