✓
Passing This code compiles and runs correctly.
Code
// Nesting recurses, it is not one level special-cased: Span lives inside
// Position lives inside Player, three deep, and the declaration is accepted
// with every leaf keeping its identity. The nested span sits first, so the
// walk feeds synthesis its first leaf two expansions down.
import std/io
import std/proto
import std/list
std/proto:f64(Health)
pub tor report-health { health: Health } -> Health
report-health -> health
std/proto(Span) {
lo: f32
hi: f32
}
std/proto(Position) {
span: Span
x: f32
}
std/proto(Player) {
pos: Position
health: Health
}
std/list:new(Player)
| list players |> std/list:push(xs: players, pos_span_lo: 0.0, pos_span_hi: 0.0, pos_x: 0.0, health: 7.5) |> std/list:pop(xs: players)
| item player |> report-health(player.health): player_out |> std/io:print.ln("player {{ player_out:d }}") |> std/list:free(xs: players)
| empty |> std/io:print.ln("player EMPTY") |> std/list:free(xs: players)
| err e |> std/io:print.ln("ERR {{ e:s }}")
Actual
player 7.5
Expected output
player 7.5
Flows
flow ~f64 click a branch to expand · @labels scroll to their anchor
f64 (expr: Health)
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Span, source: lo: f32
hi: f32)
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Position, source: span: Span
x: f32)
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Player, source: pos: Position
health: Health)
flow ~new click a branch to expand · @labels scroll to their anchor
new (Player)
Test Configuration
MUST_RUN