Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/tests/compiler/progs/casts.osc # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tests / compiler / progs / casts.osc` 15 lines ยท 556 bytes Raw Blame History 1 // entry: narrow sign_flip widen chain 2 // expect-run: narrow 127 -> 127 3 // expect-run: narrow 128 -> trap=CAST 4 // expect-run: sign_flip `4294967295` -> trap=CAST 5 // expect-run: chain 100 -> 75 6 // `as` between integer types; out-of-range traps CAST. 7 fn narrow(x: i64) -> i8 { return x as i8; } 8 fn sign_flip(x: i32) -> u32 { return x as u32; } 9 fn widen(x: u8, y: i16) -> i64 { return (x as i64) * 1000 + (y as i64); } 10 fn chain(x: u16) -> i16 { 11 let a: u32 = x as u32; 12 let b: i64 = a as i64; 13 let c: u64 = (b * 3) as u64; 14 return (c / 4) as i16; 15 }