✓
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 55613304 panic: attempt to unwrap error: ArrayLiteralInvalidTarget
???:?:?: 0x102a831df in _emitter_helpers.emitArrayLiteralForField (???)
???:?:?: 0x102a8262f in _emitter_helpers.emitArgs (???)
???:?:?: 0x102a8cfcf in _emitter_helpers.emitInvocation (???)
???:?:?: 0x102ad0c8b in _emitter_helpers.emitFlow (???)
???:?:?: 0x102c7f277 in _visitor_emitter.VisitorEmitter.visitItem (???)
???:?:?: 0x102c9b667 in _visitor_emitter.VisitorEmitter.emit (???)
???:?:?: 0x102adb727 in _backend_output_emitted.koru_std.koru_compiler.emit_zig_event.handler (???)
???:?:?: 0x1028e1c9b in _backend_output_emitted.koru_std.koru_compiler.emit_zig_artifact_event.handler (???)
???:?:?: 0x1028d7f4b in _backend_output_emitted.koru_std.koru_compiler.emission_event.handler (???)
???:?:?: 0x1028d6233 in _backend_output_emitted.koru_std.koru_compiler.coordinate_event.handler (???)
???:?:?: 0x1028d5f33 in _koru_coordinate (???)
???:?:?: 0x102866603 in _backend.RuntimeEmitter.emit (???)
???:?:?: 0x102867937 in _backend.main (???)
???:?:?: 0x102869a5b in _main (???)
???:?:?: 0x18ff4fdff in ??? (???)
???:?:?: 0x0 in ??? (???)
/Users/larsde/src/koru/scripts/regression_lib.sh: line 559: 87606 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