○
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.
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");
~tor first { value: i32 } -> i32
~proc first|zig {
return value * 2;
}
~tor second { value: i32 } -> i32
~proc second|zig {
return value * 3;
}
~tor show { outer_val: i32, inner_val: i32 }
~proc show|zig {
std.debug.print("Outer: {}, Inner: {}\n", .{outer_val, inner_val});
}
// 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): r |> second(value: r.num): r |> show(outer_val: r.num, inner_val: r.num)
Flows
flow ~first click a branch to expand · @labels scroll to their anchor
first (value: 10)
Test Configuration
Expected Error:
error: capture 'r' shadows capture from outer scope