✓
Passing This code compiles and runs correctly.
Code
// ============================================================================
// BUG 990: Slice Types from Imported Modules Generate Invalid Zig
// ============================================================================
//
// Issue: When a Koru event returns a slice of a type from an imported module,
// the generated Zig code has incorrect syntax.
//
// Expected Zig: handles: []const koru_mylib.Handle
// Actual Zig: handles: koru_[]const mylib.Handle ❌ INVALID!
//
// This affects any event that returns/accepts slices of imported types.
//
// Discovered while building $std/threading library (test 2006)
// ============================================================================
const std = @import("std");
~import $std/threading
// Minimal reproduction: Event that returns slice of imported type
~event getHandles {}
| got []const threading:WorkerHandle
~proc getHandles {
// Create empty slice just to test codegen
const handles = std.heap.page_allocator.alloc(threading:WorkerHandle, 0) catch unreachable;
return .{ .got = handles };
}
// Try to use it
~getHandles()
| got |> _
Error Verification
Actual Compiler Output
error[KORU030]: branch 'got' has payload but no binding
--> structural_check:31:0
❌ Compiler coordination error: Incomplete branch coverage
error: CompilerCoordinationFailed
/Users/larsde/src/koru/tests/regression/500_INTEGRATION_TESTING/520_BUG_REPRODUCTION/520_001_slice_type_imported_module/backend.zig:9620:17: 0x1044be4af in emit (backend)
return error.CompilerCoordinationFailed;
^
/Users/larsde/src/koru/tests/regression/500_INTEGRATION_TESTING/520_BUG_REPRODUCTION/520_001_slice_type_imported_module/backend.zig:9704:28: 0x1044bf2b7 in main (backend)
const generated_code = try RuntimeEmitter.emit(compile_allocator, final_ast);
^Test Configuration
MUST_FAIL