○
Planned This feature is planned but not yet implemented.
This should be done, it is lazily handled by the Zig-compiler, look at the README.md-file in this directory for the problem.
Error Details
output_emitted.zig:83:15: error: redeclaration of local constant 'r'
Failure Output
Showing last 10 of 105 lines
[MAIN DEBUG] emitted_file = output_emitted.zig
[MAIN DEBUG] emitted_file.ptr = u8@1006ea29e
[MAIN DEBUG] First 50 bytes: // Access compiler flags from backend.zig via root
Error: output_emitted.zig:83:15: error: redeclaration of local constant 'r'
const r = result_1.data;
^
output_emitted.zig:80:15: note: previous declaration here
const r = result_0.result;
^ Code
// Test 202c: Shadowing validation - should be rejected by Koru compiler
//
// EXPECTED BEHAVIOR: Koru compiler should reject duplicate binding names
// ACTUAL BEHAVIOR: Currently passes through to Zig, which rejects it
//
// This test documents that shadowing validation is currently "lazy" -
// we rely on Zig to catch it rather than validating in Koru compiler.
const std = @import("std");
~event first { value: i32 }
| result i32
~proc first {
return .{ .result = value * 2 };
}
~event second { value: i32 }
| data i32
~proc second {
return .{ .data = value * 3 };
}
~event show { outer_val: i32, inner_val: i32 }
| done
~proc show {
std.debug.print("Outer: {}, Inner: {}\n", .{outer_val, inner_val});
return .{ .done = .{} };
}
// ERROR: Duplicate binding name 'r'
// The outer 'r' is from | result r |>
// The inner 'r' is from | data r |>
// This should be caught by Koru compiler, not Zig compiler
~first(value: 10)
| result r |> second(value: r.num)
| data r |> show(outer_val: r.num, inner_val: r.num)
| done |> _
Test Configuration
Expected Error:
error: capture 'r' shadows capture from outer scope