interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / tests / compiler / progs / df_else.osc

18 lines · 447 bytes Raw Blame History
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).
4struct P { x: u32, y: u32 }
5
6fn 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