Rename all example tests/companions to the XXXX-category-test-name scheme (per-category 100-blocks: basic 0010, types 0100, ... errors 1000, diagnostics 1100, ffi 1200, ffi-objc 1300, ffi-jni 1400, vectors 1500, platform 1600). Companions and dir/C fixtures move in lockstep with their parent test; #import/#source/#include paths rewritten to match. Expected output now lives in examples/expected/ (a sibling dir of the tests) split into three streams per the new convention: <name>.exit / <name>.stdout / <name>.stderr (+ optional <name>.ir) run_examples.sh rewritten: scans examples/ and issues/ for an expected/<name>.exit marker, captures stdout and stderr separately (no more 2>&1), compares each stream + exit + optional IR snapshot. Behavior validated unchanged: every renamed test reproduces its prior merged output + exit (diffs limited to file paths/basenames embedded in diagnostics + traces, which correctly reflect the new names). Suite: 292 passed, 0 failed. 50-smoke.sx split + issue relocation + docs follow in subsequent commits.
31 lines
1.0 KiB
Plaintext
31 lines
1.0 KiB
Plaintext
// Variadic heterogeneous type packs — step 2b: per-call-shape
|
|
// monomorphisation. Each unique call signature gets ONE mono fn;
|
|
// repeat calls with the same signature share it. The runtime output
|
|
// confirms correct semantics; the IR (visible via `sx ir`) shows
|
|
// the distinct mono symbols:
|
|
//
|
|
// call @count__pack(ctx)
|
|
// call @count__pack_s64(ctx, 1)
|
|
// call @count__pack_s64(ctx, 2) ← shares with the 1-arg s64 call
|
|
// call @count__pack_s64_s64_s64(ctx, 1, 2, 3)
|
|
// call @count__pack_string_bool(ctx, ..)
|
|
//
|
|
// Before step 2b, each call inlined a fresh copy of the body into
|
|
// main's basic block — no shared symbols, IR size grew linearly in
|
|
// call sites. After 2b, distinct shapes get distinct functions,
|
|
// repeats share, IR scales with unique shapes.
|
|
|
|
#import "modules/std.sx";
|
|
|
|
count :: (..$args) -> s64 => args.len;
|
|
|
|
main :: () -> s32 {
|
|
a := count();
|
|
b := count(1);
|
|
c := count(2);
|
|
d := count(1, 2, 3);
|
|
e := count("x", true);
|
|
print("{} {} {} {} {}\n", a, b, c, d, e);
|
|
return 0;
|
|
}
|