?
Unknown Status unknown.
Code
// Test: Interpreter binding reference evaluation in args
//
// This tests that when we chain events like:
// ~first() | ok x |> second(arg: x.field)
//
// The interpreter evaluates x.field against the environment,
// NOT passing the literal string "x.field".
~import std/runtime
~import std/interpreter
~import std/io
const std = @import("std");
// Event that produces a value
~pub tor produce {} -> string
~proc produce|zig {
return "42";
}
// Event that consumes a value and echoes it
~pub tor consume { n: string }
| echoed string
~consume = std/io:print.ln("[consume] received n = '{{n:s}}'") => echoed n
~std/runtime:register(scope: "test") {
produce
consume
}
// The flow we'll interpret:
// ~produce() | value v |> consume(n: v.num)
//
// Expected: consume receives "42" (the actual value)
// Bug: consume receives "v.num" (the literal string)
const TEST_FLOW =
\\~produce()
\\| value v |> consume(n: v.num)
;
~std/interpreter:run(source: TEST_FLOW, dispatcher: dispatch_test)
| result r |> std/io:print.ln("Result: {{ r.value.branch:s }}")
| exhausted e |> std/io:print.ln("Exhausted: {{ e.last_event:s }}")
| parse-error e |> std/io:print.ln("Parse error: {{ e.message:s }}")
| validation-error e |> std/io:print.ln("Validation error: {{ e:s }}")
| dispatch-error e |> std/io:print.ln("Dispatch error: {{ e.message:s }}")
Expected output
[consume] received n = '42'
Result: echoed
Flows
subflow ~consume click a branch to expand · @labels scroll to their anchor
print.ln (expr: "[consume] received n = '{{n:s}}'")
flow ~register click a branch to expand · @labels scroll to their anchor
register (scope: "test", source: produce
consume)
flow ~run click a branch to expand · @labels scroll to their anchor
run (source: TEST_FLOW, dispatcher: dispatch_test)
Test Configuration
MUST_RUN