//ww:run-exit 0 // A yield inside a switch arm yields from the enclosing MATCH; the // match-yield walk didn't descend into N_SWITCH, so the match typed // void and the yielded value was dropped. package main; fn pick(v: (i32 | str)) i32 = { let r: i32 = match (v) { case let x: i32 => switch (x) { case 2: yield 42; case: yield 7; }; case let s: str => yield 0; }; return r; }; export fn main() i32 = { let u: (i32 | str) = 2; if (pick(u) == 42) { return 0; }; return 1; };