✓
Passing Passing: the compiler rejects this program as expected.
Code
// A call inside a tor field default is the same violation the
// expression-admission wall refuses in every other expression carrier —
// calls are not expressions. The default text is spliced verbatim into the
// emitted Input struct, so a Koru call there reaches the backend raw.
const std = @import("std");
~tor helper {} -> i64
~proc helper|zig { return 42; }
~pub tor poll { x: i64 = helper() }
| done
| failed string
~proc poll|zig {
std.debug.print("x={}\n", .{x});
return .{ .done = .{} };
}
~poll()
| done |> _
| failed _ |> _
Actual compiler output
error[KORU104]: nested call in field default 'x' — calls are not expressions; use tor chaining: bind the result first
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_263_call_in_field_default_refused/input.kz:11:0
|
11 | ~pub tor poll { x: i64 = helper() }
| ^
hint: rewrite as `tor(args): x |> ...` and use `x` hereFrontend must reject with:
CONTAINS error[KORU104]
CONTAINS field default 'x'
CONTAINS calls are not expressions
ERROR_AT 11Flows
flow ~poll click a branch to expand · @labels scroll to their anchor
poll
Test Configuration
MUST_ERROR