Every section banner dies (103 -> 0) across test/lang, the observer suites, the C carriers, and the five comment-heavy corpus fixtures; banner provenance (#N cites, carrier numbers, repair-cluster labels) folded into headers or adjacent WHY comments. Narration deleted; row provenance, ref cites, divergence pins, and layout contracts kept (fwd-ref decl-order guards and bootstrap-gate corpus rationale restored where the sweep over-cut). Comment-only proven: all 3742 wwbuild workdir .s byte-identical before/after; test-commit and test-byteid (161 lang + 1399 data, 0 pinned-divergent) green.
76 lines
1.6 KiB
Plaintext
76 lines
1.6 KiB
Plaintext
// A `!void` error singleton (tag-only) across
|
|
// return / let-init / assign / call-arg positions, plus a wide (str) success
|
|
// payload exercising CX/R8 zeroing on the tag-only return. Migrated from
|
|
// test/wcc/949_void_error_singleton_run.c (value rows; C driver asserted cs==ww .s).
|
|
|
|
package void_error_singleton_test;
|
|
|
|
type too_long = !void;
|
|
|
|
fn f_ret_singleton() (i64 | too_long) = {
|
|
return too_long;
|
|
};
|
|
|
|
fn f_ret_success() (i64 | too_long) = {
|
|
return 42i64;
|
|
};
|
|
|
|
fn use_callarg(r: (i64 | too_long)) i32 = {
|
|
match (r) {
|
|
case let v: i64 => return 1;
|
|
case too_long => return 0;
|
|
};
|
|
return 2;
|
|
};
|
|
|
|
fn f_wide(ok: bool) (str | too_long) = {
|
|
if (ok) { return "hello"; };
|
|
return too_long;
|
|
};
|
|
|
|
@test fn return_singleton() void = {
|
|
match (f_ret_singleton()) {
|
|
case let v: i64 => { assert(false); };
|
|
case too_long => { };
|
|
};
|
|
};
|
|
|
|
@test fn return_success() void = {
|
|
match (f_ret_success()) {
|
|
case let v: i64 => { assert(v == 42); };
|
|
case too_long => { assert(false); };
|
|
};
|
|
};
|
|
|
|
@test fn letinit_singleton() void = {
|
|
let e: (i64 | too_long) = too_long;
|
|
match (e) {
|
|
case let v: i64 => { assert(false); };
|
|
case too_long => { };
|
|
};
|
|
};
|
|
|
|
@test fn assign_singleton() void = {
|
|
let e: (i64 | too_long) = 5i64;
|
|
e = too_long;
|
|
match (e) {
|
|
case let v: i64 => { assert(false); };
|
|
case too_long => { };
|
|
};
|
|
};
|
|
|
|
@test fn callarg_singleton() void = {
|
|
assert(use_callarg(too_long) == 0);
|
|
};
|
|
|
|
@test fn return_singleton_wide() void = {
|
|
match (f_wide(false)) {
|
|
case let s: str => { assert(false); };
|
|
case too_long => { };
|
|
};
|
|
match (f_wide(true)) {
|
|
case let s: str => { assert(s.len == 5); };
|
|
case too_long => { assert(false); };
|
|
};
|
|
};
|