✗
Failing This test is currently failing.
Failed: error-output
Failure Output
error[KORU100]: unused binding 'g'
--> tests/regression/000_CORE_LANGUAGE/020_EVENTS_FLOWS/020_013_reject_function_call_in_branch_constructor/input.kz:27:0
|
27 | ~greet(name: "world"): g -> { value: helper(g.msg) }
| ^
hint: discard the binding using `_` if not needed Code
// Test: Parser should reject function calls in branch constructors
//
// Branch constructors must contain only pure values: literals, bindings,
// field access, and expressions. Function calls introduce side effects
// and are not allowed. Use event chaining instead:
//
// WRONG: | ok x -> { value: computeIt(x) }
// RIGHT: | ok x |> compute(input: x)
// | value v -> { value: v }
~import std/io
const std = @import("std");
fn helper(x: []const u8) []const u8 { return x; }
~tor greet { name: string } -> string
~proc greet|zig {
const buf = std.fmt.comptimePrint("Hello {s}", .{name});
return buf;
}
~tor transform { input: string } -> string
// INVALID: function call helper() inside branch constructor
~greet(name: "world"): g -> { value: helper(g.msg) }
Must fail at frontend compile:
Parsing or type-checking must reject the program.
Expected compiler error
error[PARSE003]: branch constructor field 'value' contains a function call — branch constructors must be pure. Use tor chaining instead.
--> tests/regression/000_CORE_LANGUAGE/020_EVENTS_FLOWS/020_013_reject_function_call_in_branch_constructor/input.kz:29:1
|
29 |
| ^
Flows
flow ~greet click a branch to expand · @labels scroll to their anchor
greet (name: "world")