// 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); }; }; };