037 interpreter field types

✓ Passing This code compiles and runs correctly.

Code

// Test: Interpreter numeric FieldValue in expressions
// Ensures FieldValue.int_val is propagated to expr bindings (no string reparse)

~import "$std/runtime"
~import "$std/interpreter"
~import "$std/io"

const std = @import("std");

// Event producing an integer field
~pub event produce_int {}
| value { num: i32 }

~proc produce_int {
    return .{ .value = .{ .num = 12 } };
}

// Register scope
~std.runtime:register(scope: "test") {
    produce_int
}

const TEST_SOURCE =
    \\~produce_int()
    \\| value v |> if(v.num > 10)
    \\    | then |> gt {}
    \\    | else |> lte {}
;

~std.runtime:get_scope(name: "test")
| scope s |> std.interpreter:run(source: TEST_SOURCE, dispatcher: s.dispatcher)
    | result r |> std.io:print.ln("SUCCESS branch={{ r.value.branch:s }}")
    | exhausted e |> std.io:print.ln("EXHAUSTED: {{ e.last_event }}")
    | parse_error e |> std.io:print.ln("PARSE ERROR: {{ e.message }}")
    | validation_error e |> std.io:print.ln("VALIDATION ERROR: {{ e.message }}")
    | dispatch_error e |> std.io:print.ln("DISPATCH ERROR: {{ e.message }}")
| not_found |> std.io:print.ln("SCOPE NOT FOUND")
input.kz

Expected Output

SUCCESS branch=gt

Test Configuration

MUST_RUN