✓
Passing This code compiles and runs correctly.
Code
// Test: Basic struct declaration via types module
//
// Surface vs emission: the Koru surface spelling for a string is
// `string`. A `~std/types:struct` body holds ZIG EMISSION text, so the
// generator writes what `string` lowers to (`[]const u8`,
// emitter_helpers.lowerZigType). Koru-space never spells `[]const u8`;
// it is only what the generator emits to the host. The body will speak
// `string` directly once the generator lowers surface types itself.
~import std/types
~import std/io
// Declare a struct type
~std/types:struct(Player) {
name: []const u8,
health: i32,
}
// Use the struct to prove it compiled
const player = Player{ .name = "Alice", .health = 100 };
~std/io:print.ln("Player: {{ player.name:s }}, Health: {{ player.health:d }}")
Actual
Player: Alice, Health: 100
Expected output
Player: Alice, Health: 100
Flows
flow ~struct click a branch to expand · @labels scroll to their anchor
struct (expr: Player, source: name: []const u8,
health: i32,)
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "Player: {{ player.name:s }}, Health: {{ player.health:d }}")
Test Configuration
MUST_RUN