// nested_union_widen_test — widening a nested named error-union (inner = !(i32|bool)) // into an enclosing (size | inner) union must keep the inner box distinguishable // and destructurable across outer-arm select, fn-return, and let-init. Migrated // from test/wcc/925_nested_union_widen_run.c (value rows). The same-shape // collision row (two distinct names !(i32|bool)) loud-stops both stages and lives // at test/wcc/data/nestunion_collision/ as a runww //ww:error carrier. package nested_union_widen_test; type inner = !(i32 | bool); fn g_dr() (size | inner) = { let e: inner = (5i32: inner); return e; }; @test fn outer_arm_select() void = { let e: inner = (true: inner); let r: (size | inner) = e; match (r) { case let n: size => { assert(false); }; case let x: inner => { }; }; }; @test fn destructure_return() void = { match (g_dr()) { case let s: size => { assert(false); }; case let x: inner => { match (x) { case let i: i32 => { assert(i == 5); }; case let b: bool => { assert(false); }; }; }; }; }; @test fn destructure_let() void = { let e: inner = (7i32: inner); let r: (size | inner) = e; match (r) { case let n: size => { assert(false); }; case let x: inner => { match (x) { case let i: i32 => { assert(i == 7); }; case let b: bool => { assert(false); }; }; }; }; }; @test fn single_variant() void = { let r: (i32 | bool) = 7i32; match (r) { case let n: i32 => { assert(n == 7); }; case let b: bool => { assert(false); }; }; };