slovo/tests/numeric-widening-conversions.checked.lower
2026-05-22 08:38:43 +02:00

46 lines
1.1 KiB
Plaintext

program main
fn base_i64() -> i64
call std.num.i32_to_i64 : i64
int 2147483647 : i32
fn widened_i64() -> i64
binary + : i64
call base_i64 : i64
i64 1 : i64
fn half_step() -> f64
binary + : f64
call std.num.i32_to_f64 : f64
int 5 : i32
float 0.5 : f64
fn wide_as_f64() -> f64
call std.num.i64_to_f64 : f64
call widened_i64 : i64
fn main() -> i32
call std.io.print_i64 : unit
call widened_i64 : i64
call std.io.print_f64 : unit
call wide_as_f64 : f64
if : i32
binary = : bool
call widened_i64 : i64
i64 2147483648 : i64
int 0 : i32
int 1 : i32
test "i32 widens to i64"
binary = : bool
call std.num.i32_to_i64 : i64
int 42 : i32
i64 42 : i64
test "i32 to i64 feeds i64 arithmetic"
binary = : bool
call widened_i64 : i64
i64 2147483648 : i64
test "i32 widens to f64"
binary = : bool
call std.num.i32_to_f64 : f64
int 42 : i32
float 42 : f64
test "i64 widens to f64"
binary = : bool
call wide_as_f64 : f64
float 2147483648 : f64