✓
Passing This code compiles and runs correctly.
Code
// Test: ~[pub] struct as keyword
//
// Pub annotation should still work with keyword syntax.
~import std/types
~import std/io
// Private struct
~struct(Internal) {
value: i32,
}
// Public struct
~[pub] struct(Position) {
x: f32,
y: f32,
}
const p = Position{ .x = 1.0, .y = 2.0 };
const i = Internal{ .value = 42 };
~std/io:print.ln("x={{ p.x:any }}, y={{ p.y:any }}, v={{ i.value:d }}")
Actual
x=1, y=2, v=42
Expected output
x=1, y=2, v=42
Flows
flow ~struct click a branch to expand · @labels scroll to their anchor
struct (Internal, source: value: i32,)
flow ~struct click a branch to expand · @labels scroll to their anchor
struct (Position, source: x: f32,
y: f32,)
flow ~print.ln click a branch to expand · @labels scroll to their anchor
print.ln (expr: "x={{ p.x:any }}, y={{ p.y:any }}, v={{ i.value:d }}")
Test Configuration
MUST_RUN