//! > Test implicits with multiple jumps to arm blocks.
//! > test_runner_name
test_function_lowering
//! > function
fn foo(a: u256) -> u64 {
U256TryIntoU64::try_into(a).unwrap()
}
//! > function_name
foo
//! > module_code
impl U256TryIntoU64 of TryInto<u256, u64> {
#[inline(always)]
fn try_into(self: u256) -> Option<u64> {
if (self.high == 0) {
self.low.try_into()
} else {
Option::None
}
}
}
//! > semantic_diagnostics
//! > lowering_diagnostics
//! > lowering_flat
Parameters: v31: core::RangeCheck, v0: core::integer::u256
blk0 (root):
Statements:
(v10: core::integer::u128, v11: core::integer::u128) <- struct_destructure(v0)
(v12: core::integer::u128) <- 0
End:
Match(match core::integer::u128_eq(v11, v12) {
bool::False => blk1,
bool::True => blk2,
})
blk1:
Statements:
End:
Goto(blk5, {v31 -> v32})
blk2:
Statements:
End:
Match(match core::integer::downcast::<core::integer::u128, core::integer::u64>(v31, v10) {
Option::Some(v33, v15) => blk3,
Option::None(v34) => blk4,
})
blk3:
Statements:
(v21: (core::integer::u64,)) <- struct_construct(v15)
(v22: core::panics::PanicResult::<(core::integer::u64,)>) <- PanicResult::Ok(v21)
End:
Return(v33, v22)
blk4:
Statements:
End:
Goto(blk5, {v34 -> v32})
blk5:
Statements:
(v23: core::array::Array::<core::felt252>) <- core::array::array_new::<core::felt252>()
(v24: core::felt252) <- 29721761890975875353235833581453094220424382983267374
(v25: core::array::Array::<core::felt252>) <- core::array::array_append::<core::felt252>(v23, v24)
(v26: core::panics::Panic) <- struct_construct()
(v27: (core::panics::Panic, core::array::Array::<core::felt252>)) <- struct_construct(v26, v25)
(v28: core::panics::PanicResult::<(core::integer::u64,)>) <- PanicResult::Err(v27)
End:
Return(v32, v28)
//! > lowering
Main:
Parameters:
blk0 (root):
Statements:
(v0: core::felt252) <- 5u
(v2: core::felt252, v1: core::bool) <- foo[expr14](v0)
End:
Return(v1)
Generated:
Parameters: v0: core::felt252
blk0 (root):
Statements:
(v1: core::felt252) <- 1u
(v2: core::felt252) <- core::Felt252Add::add(v0, v1)
(v3: core::felt252) <- 10u
(v4: core::felt252) <- core::Felt252Sub::sub(v2, v3)
End:
Match(match core::felt252_is_zero(v4) {
IsZeroResult::Zero => blk1,
IsZeroResult::NonZero(v7) => blk2,
})
blk1:
Statements:
(v5: ()) <- struct_construct()
(v6: core::bool) <- bool::True(v5)
End:
Return(v2, v6)
blk2:
Statements:
End:
Goto(blk3, {})
blk3:
Statements:
(v9: core::felt252, v8: core::bool) <- foo[expr14](v2)
End:
Return(v9, v8)