✓
Passing This code compiles and runs correctly.
Code
// Test 202b: Shadowing behavior - compiler forbids duplicate binding names
// This test confirms that Koru does NOT allow binding shadowing.
//
// Expected: This should compile and run successfully with unique binding names.
// If this test passes, it proves shadowing is forbidden (changing 'd' to 'r' breaks it).
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 = .{} };
}
// Test: Use unique binding names (r and d)
~first(value: 10)
| result r |> second(value: r)
| data d |> show(outer_val: r, inner_val: d)
| done |> _
Expected
Outer: 20, Inner: 60
Actual
Outer: 20, Inner: 60
Test Configuration
MUST_RUN