Break the monolithic examples/50-smoke.sx into 30 focused per-section examples,
filed into their category blocks (basic/types/comptime/memory/protocols/ffi),
each carrying only the top-level decls its section references (the protocols
section keeps the full preamble — its deps flow through UFCS method calls that
name-based extraction can't see). Outputs verified identical to the original
section blocks.
Add examples/1036-errors-failable-smoke.sx — an end-to-end error-handling example
(the E5.4 work): named + inferred error sets consumed via destructure, try (in
helpers), catch (bare-expr / match-body / diverging / no-binding), or
value-terminator, onfail+defer interleave, and error.X value + {} tag
interpolation.
Remove examples/50-smoke.sx. Suite: 324 passed, 0 failed.
37 lines
996 B
Plaintext
37 lines
996 B
Plaintext
#import "modules/std.sx";
|
|
#import "modules/math/math.sx";
|
|
#import "modules/compiler.sx";
|
|
#import "modules/test.sx";
|
|
pkg :: #import "modules/testpkg";
|
|
|
|
add :: (a: s32, b: s32) -> s32 { a + b; }
|
|
|
|
main :: () {
|
|
|
|
// ── Trailing commas ──────────────────────────────────────────
|
|
print("=== Trailing Commas ===\n");
|
|
{
|
|
// Struct literal with trailing comma
|
|
Vec4 :: struct { x: f64; y: f64; z: f64; w: f64; }
|
|
v := Vec4.{
|
|
x = 1.0,
|
|
y = 2.0,
|
|
z = 3.0,
|
|
w = 4.0,
|
|
};
|
|
assert(v.x == 1.0);
|
|
assert(v.w == 4.0);
|
|
|
|
// Function call with trailing comma
|
|
add :: (a: s64, b: s64) -> s64 { return a + b; }
|
|
r := add(10, 20,);
|
|
assert(r == 30);
|
|
|
|
// Array literal with trailing comma
|
|
arr := s64.[1, 2, 3,];
|
|
assert(arr[2] == 3);
|
|
|
|
print("trailing commas ok\n");
|
|
}
|
|
}
|