✓
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 348708330 panic: attempt to unwrap error: ArrayLiteralInvalidTarget
???:?:?: 0x1051ef687 in _emitter_helpers.emitArrayLiteralForField (???)
???:?:?: 0x1051eeacb in _emitter_helpers.emitArgs (???)
???:?:?: 0x1051f6617 in _emitter_helpers.emitInvocation (???)
???:?:?: 0x10522b97f in _emitter_helpers.emitFlow (???)
???:?:?: 0x1052927ab in _visitor_emitter.VisitorEmitter.visitItem (???)
???:?:?: 0x1052ae4e7 in _visitor_emitter.VisitorEmitter.emit (???)
???:?:?: 0x105082d53 in _backend_output_emitted.koru_std.koru_compiler.emit_zig_event.handler (???)
???:?:?: 0x10507941f in _backend_output_emitted.koru_std.koru_compiler.emission_event.handler (???)
???:?:?: 0x1050778eb in _backend_output_emitted.koru_std.koru_compiler.coordinate_event.handler (???)
???:?:?: 0x1050775eb in _koru_coordinate (???)
???:?:?: 0x104ff53fb in _backend.RuntimeEmitter.emit (???)
???:?:?: 0x104ff6ef7 in _backend.main (???)
???:?:?: 0x105002207 in _main (???)
???:?:?: 0x1816a3dff in ??? (???)
???:?:?: 0x0 in ??? (???)
/Users/larsde/src/koru/scripts/regression_lib.sh: line 494: 29388 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