omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / tests / compiler / progs / df_else.osc
| 1 | // entry: f |
| 2 | // OSC-3 item 3 (drop flags): a struct owner moved in the else-branch only |
| 3 | // (by a let-move into a branch-local owner, released at the branch end). |
| 4 | struct P { x: u32, y: u32 } |
| 5 | |
| 6 | fn f(k: u32) -> u32 { |
| 7 | let p: own P = P { x: k & 255, y: 3 }; |
| 8 | let mut r: u32 = 1; |
| 9 | if k < 10 { |
| 10 | r = r + p.x; |
| 11 | } else { |
| 12 | let q: own P = p; |
| 13 | r = q.y * 2; |
| 14 | } |
| 15 | return r; |
| 16 | } |
| 17 | // expect-run: f 4 -> 5 |
| 18 | // expect-run: f 12 -> 6 |