✓
Passing This code compiles and runs correctly.
Code
// Test: compound phantom labels carry the result of dimensional arithmetic.
//
// `i32[meter]` divided by `i32[second]` returns `i32[meter/second]`. The
// phantom checker doesn't derive that relationship — the author declares it
// in the converter event's signature. The `/` in the label is just opaque
// characters; what makes it meaningful is that a producer event has it as
// an output and that producer's input/output declarations match physical
// units.
import std/io
event read-distance { trip_id: u8 } -> i32<meter>
read-distance -> 100
event read-time { trip_id: u8 } -> i32<second>
read-time -> 4
event compute-velocity { d: i32<meter>, t: i32<second> } -> i32<meter/second>
compute-velocity -> d / t
read-distance(trip_id: 1): m |> read-time(trip_id: 1): s |> compute-velocity(d: m, t: s): v |> std/io:print.ln("{{ v:d }} m/s")
Actual
25 m/s
Expected output
25 m/s
Flows
flow ~read-distance click a branch to expand · @labels scroll to their anchor
read-distance (trip_id: 1)
Test Configuration
MUST_RUN