From a6bc71da0458556f8a7f5a78bf03051f58bad210 Mon Sep 17 00:00:00 2001 From: Lior Goldberg Date: Thu, 31 Jul 2025 18:56:08 +0300 Subject: [PATCH] flow_control: Small changes in lower_if_bool_condition to align with the new code. commit-id:97600111 --- .../src/borrow_check/test_data/borrow_check | 35 +++--- .../src/inline/test_data/inline | 14 +-- .../cairo-lang-lowering/src/lower/lower_if.rs | 31 ++--- .../src/lower/lower_match.rs | 2 +- .../src/lower/test_data/closure | 6 +- .../src/lower/test_data/loop | 118 +++++++++--------- .../src/optimizations/test_data/gas_redeposit | 24 ++-- .../optimizations/test_data/trim_unreachable | 14 +-- .../src/statement_location_test_data/simple | 56 ++++++--- 9 files changed, 164 insertions(+), 136 deletions(-) diff --git a/crates/cairo-lang-lowering/src/borrow_check/test_data/borrow_check b/crates/cairo-lang-lowering/src/borrow_check/test_data/borrow_check index b2ff8a40332..69afb022f55 100644 --- a/crates/cairo-lang-lowering/src/borrow_check/test_data/borrow_check +++ b/crates/cairo-lang-lowering/src/borrow_check/test_data/borrow_check @@ -108,9 +108,12 @@ error: Variable not dropped. fn foo(x: ACopy, y: ADrop) -> ADrop { ^ note: the variable needs to be dropped due to the divergence here: - --> lib.cairo:9:8 - if true { - ^^^^ + --> lib.cairo:9:5-12:13 + if true { + _____^ +| ... +| } else {} +|_____________^ note: Trait has no implementation in context: core::traits::Drop::. note: Trait has no implementation in context: core::traits::Destruct::. @@ -646,16 +649,16 @@ Statements: (v8: core::bool) <- core::integer::U8PartialEq::eq(v4{`self.b`}, v7{`0`}) End: Match(match_enum(v8{`self.b == 0`}) { - bool::False(v11) => blk2, + bool::False(v10) => blk2, bool::True(v9) => blk1, }) blk1: Statements: - (v10: core::array::Array::) <- core::array::ArrayDefault::::default() - () <- test::invalidate(v10{`self.a`}) + (v11: core::array::Array::) <- core::array::ArrayDefault::::default() + () <- test::invalidate(v11{`self.a`}) End: - Goto(blk3, {v3 -> v12, v10 -> v13}) + Goto(blk3, {v3 -> v12, v11 -> v13}) blk2: Statements: @@ -712,16 +715,16 @@ Statements: (v8: core::bool) <- core::integer::U8PartialEq::eq(v4{`v.b`}, v7{`0`}) End: Match(match_enum(v8{`v.b == 0`}) { - bool::False(v11) => blk2, + bool::False(v10) => blk2, bool::True(v9) => blk1, }) blk1: Statements: - (v10: core::array::Array::) <- core::array::ArrayDefault::::default() - () <- test::invalidate(v10{`v.a`}) + (v11: core::array::Array::) <- core::array::ArrayDefault::::default() + () <- test::invalidate(v11{`v.a`}) End: - Goto(blk3, {v3 -> v12, v10 -> v13}) + Goto(blk3, {v3 -> v12, v11 -> v13}) blk2: Statements: @@ -824,16 +827,16 @@ Statements: (v2: core::bool) <- bool::True(v1{`true`}) End: Match(match_enum(v2{`true`}) { - bool::False(v8) => blk2, + bool::False(v4) => blk2, bool::True(v3) => blk1, }) blk1: Statements: - (v4: core::integer::u32) <- struct_destructure(v0{`a.x`}) - (v5: core::integer::u32, v6: @core::integer::u32) <- snapshot(v4{`a.x`}) - (v7: ()) <- test::bar(v6{`@a.x`}) - (v10: test::A) <- struct_construct(v5{`true`}) + (v5: core::integer::u32) <- struct_destructure(v0{`a.x`}) + (v6: core::integer::u32, v7: @core::integer::u32) <- snapshot(v5{`a.x`}) + (v8: ()) <- test::bar(v7{`@a.x`}) + (v10: test::A) <- struct_construct(v6{`if true { bar(@a.x); }`}) End: Goto(blk3, {v10 -> v9}) diff --git a/crates/cairo-lang-lowering/src/inline/test_data/inline b/crates/cairo-lang-lowering/src/inline/test_data/inline index 9010cfc834d..e1181334e72 100644 --- a/crates/cairo-lang-lowering/src/inline/test_data/inline +++ b/crates/cairo-lang-lowering/src/inline/test_data/inline @@ -399,15 +399,15 @@ Statements: (v6: core::bool) <- core::Felt252PartialEq::eq(v2, v5) End: Match(match_enum(v6) { - bool::False(v9) => blk2, + bool::False(v8) => blk2, bool::True(v7) => blk1, }) blk1: Statements: - (v8: core::felt252) <- test::bar(v1) + (v9: core::felt252) <- test::bar(v1) End: - Goto(blk3, {v8 -> v10}) + Goto(blk3, {v9 -> v10}) blk2: Statements: @@ -473,7 +473,7 @@ blk7: Statements: End: Match(match_enum(v6) { - bool::False(v9) => blk2, + bool::False(v8) => blk2, bool::True(v7) => blk1, }) @@ -489,18 +489,18 @@ blk9: Statements: (v20: core::felt252) <- 1 End: - Goto(blk11, {v20 -> v8}) + Goto(blk11, {v20 -> v9}) blk10: Statements: (v21: core::felt252) <- 0 End: - Goto(blk11, {v21 -> v8}) + Goto(blk11, {v21 -> v9}) blk11: Statements: End: - Goto(blk3, {v8 -> v10}) + Goto(blk3, {v9 -> v10}) //! > lowering_diagnostics diff --git a/crates/cairo-lang-lowering/src/lower/lower_if.rs b/crates/cairo-lang-lowering/src/lower/lower_if.rs index df0ab01b106..1092548f1cf 100644 --- a/crates/cairo-lang-lowering/src/lower/lower_if.rs +++ b/crates/cairo-lang-lowering/src/lower/lower_if.rs @@ -24,13 +24,15 @@ use crate::{MatchArm, MatchEnumInfo, MatchInfo}; /// /// In particular, note that if `conditions` is empty, there are no conditions and the /// expression is simply [Self::expr]. -pub struct ConditionedExpr<'a> { +pub struct ConditionedExpr<'db, 'a> { pub expr: semantic::ExprId, pub conditions: &'a [Condition], pub else_block: Option, + /// The location of the `if` expression. + pub if_expr_location: LocationId<'db>, } -impl ConditionedExpr<'_> { +impl ConditionedExpr<'_, '_> { /// Returns a copy of self, without the first condition. pub fn remove_first(&self) -> Self { Self { conditions: &self.conditions[1..], ..*self } @@ -59,6 +61,7 @@ pub fn lower_expr_if<'db>( expr: expr.if_block, conditions: &expr.conditions, else_block: expr.else_block, + if_expr_location: ctx.get_location(expr.stable_ptr.untyped()), }, ) } @@ -68,21 +71,21 @@ pub fn lower_if_bool_condition<'db>( ctx: &mut LoweringContext<'db, '_>, builder: &mut BlockBuilder<'db>, condition: semantic::ExprId, - inner_expr: ConditionedExpr<'_>, + inner_expr: ConditionedExpr<'db, '_>, ) -> LoweringResult<'db, LoweredExpr<'db>> { // The condition cannot be unit. let condition_var = lower_expr_to_var_usage(ctx, builder, condition)?; let db = ctx.db; let unit_ty = corelib::unit_ty(db); - let condition_expr = &ctx.function_body.arenas.exprs[condition]; - let stable_ptr = condition_expr.stable_ptr().untyped(); - let condition_location = ctx.get_location(stable_ptr); + let if_expr_location = inner_expr.if_expr_location; // Main block. let subscope_main = create_subscope(ctx, builder); let block_main_id = subscope_main.block_id; - let main_block_var_id = ctx.new_var(VarRequest { ty: unit_ty, location: condition_location }); + let main_block_var_id = ctx.new_var(VarRequest { ty: unit_ty, location: if_expr_location }); + let else_block_input_var_id = + ctx.new_var(VarRequest { ty: unit_ty, location: if_expr_location }); let block_main = lower_conditioned_expr_and_seal(ctx, subscope_main, &inner_expr) .map_err(LoweringFlowError::Failed)?; @@ -91,10 +94,8 @@ pub fn lower_if_bool_condition<'db>( let subscope_else = create_subscope(ctx, builder); let block_else_id = subscope_else.block_id; - let else_block_input_var_id = - ctx.new_var(VarRequest { ty: unit_ty, location: condition_location }); let block_else = - lower_optional_else_block(ctx, subscope_else, inner_expr.else_block, condition_location) + lower_optional_else_block(ctx, subscope_else, inner_expr.else_block, if_expr_location) .map_err(LoweringFlowError::Failed)?; let match_info = MatchInfo::Enum(MatchEnumInfo { @@ -112,13 +113,13 @@ pub fn lower_if_bool_condition<'db>( var_ids: vec![main_block_var_id], }, ], - location: condition_location, + location: if_expr_location, }); builder.merge_and_end_with_match( ctx, match_info, vec![block_main, block_else], - condition_location, + if_expr_location, ) } @@ -128,7 +129,7 @@ pub fn lower_if_let_condition<'db>( builder: &mut BlockBuilder<'db>, matched_expr_id: semantic::ExprId, patterns: &[semantic::PatternId], - inner_expr: ConditionedExpr<'_>, + inner_expr: ConditionedExpr<'db, '_>, ) -> LoweringResult<'db, LoweredExpr<'db>> { let matched_expr = &ctx.function_body.arenas.exprs[matched_expr_id]; let stable_ptr = matched_expr.stable_ptr().untyped(); @@ -169,7 +170,7 @@ pub fn lower_if_let_condition<'db>( fn lower_conditioned_expr<'db>( ctx: &mut LoweringContext<'db, '_>, builder: &mut BlockBuilder<'db>, - expr: &ConditionedExpr<'_>, + expr: &ConditionedExpr<'db, '_>, ) -> LoweringResult<'db, LoweredExpr<'db>> { log::trace!( "Lowering a conditioned expression: {:?} (# of conditions: {})", @@ -196,7 +197,7 @@ fn lower_conditioned_expr<'db>( pub fn lower_conditioned_expr_and_seal<'db>( ctx: &mut LoweringContext<'db, '_>, mut builder: BlockBuilder<'db>, - expr: &ConditionedExpr<'_>, + expr: &ConditionedExpr<'db, '_>, ) -> Maybe> { let lowered_expr = lower_conditioned_expr(ctx, &mut builder, expr); lowered_expr_to_block_scope_end(ctx, builder, lowered_expr) diff --git a/crates/cairo-lang-lowering/src/lower/lower_match.rs b/crates/cairo-lang-lowering/src/lower/lower_match.rs index 97135acdcde..f84f0bb9859 100644 --- a/crates/cairo-lang-lowering/src/lower/lower_match.rs +++ b/crates/cairo-lang-lowering/src/lower/lower_match.rs @@ -74,7 +74,7 @@ pub enum MatchArmWrapper<'db, 'a> { ), /// Similar to [Self::Arm], except that the expression is a conditioned expression /// (see [ConditionedExpr]). - ConditionedArm(&'a [PatternId], ConditionedExpr<'a>), + ConditionedArm(&'a [PatternId], ConditionedExpr<'db, 'a>), } impl<'db, 'a> From<&'a semantic::MatchArm> for MatchArmWrapper<'db, 'a> { diff --git a/crates/cairo-lang-lowering/src/lower/test_data/closure b/crates/cairo-lang-lowering/src/lower/test_data/closure index c060de79590..5f573da6637 100644 --- a/crates/cairo-lang-lowering/src/lower/test_data/closure +++ b/crates/cairo-lang-lowering/src/lower/test_data/closure @@ -404,15 +404,15 @@ Statements: (v13: core::bool) <- core::Felt252PartialEq::eq(v9, v12) End: Match(match_enum(v13) { - bool::False(v17) => blk2, + bool::False(v15) => blk2, bool::True(v14) => blk1, }) blk1: Statements: - (v15: core::felt252, v16: @core::felt252) <- snapshot(v3) + (v16: core::felt252, v17: @core::felt252) <- snapshot(v3) End: - Goto(blk3, {v15 -> v20, v16 -> v21}) + Goto(blk3, {v16 -> v20, v17 -> v21}) blk2: Statements: diff --git a/crates/cairo-lang-lowering/src/lower/test_data/loop b/crates/cairo-lang-lowering/src/lower/test_data/loop index 60b823b341b..827edcdd759 100644 --- a/crates/cairo-lang-lowering/src/lower/test_data/loop +++ b/crates/cairo-lang-lowering/src/lower/test_data/loop @@ -84,16 +84,16 @@ Statements: (v8: core::bool) <- core::Felt252PartialEq::eq(v4, v7) End: Match(match_enum(v8) { - bool::False(v12) => blk2, + bool::False(v10) => blk2, bool::True(v9) => blk1, }) blk1: Statements: - (v10: ()) <- struct_construct() - (v11: core::bool) <- bool::True(v10) + (v11: ()) <- struct_construct() + (v12: core::bool) <- bool::True(v11) End: - Return(v2, v11) + Return(v2, v12) blk2: Statements: @@ -240,16 +240,16 @@ Statements: (v8: core::bool) <- core::Felt252PartialEq::eq(v4, v7) End: Match(match_enum(v8) { - bool::False(v12) => blk2, + bool::False(v10) => blk2, bool::True(v9) => blk1, }) blk1: Statements: - (v10: ()) <- struct_construct() - (v11: core::bool) <- bool::True(v10) + (v11: ()) <- struct_construct() + (v12: core::bool) <- bool::True(v11) End: - Return(v3, v11) + Return(v3, v12) blk2: Statements: @@ -414,20 +414,20 @@ Statements: (v7: core::bool) <- bool::True(v6) End: Match(match_enum(v7) { - bool::False(v16) => blk2, + bool::False(v9) => blk2, bool::True(v8) => blk1, }) blk1: Statements: - (v9: core::felt252) <- 1 - (v10: core::felt252) <- 4 - (v11: core::felt252) <- 5 - (v12: test::B) <- struct_construct(v0, v5) - (v13: test::A) <- struct_construct(v12, v11) - (v14: core::integer::u32, v15: core::integer::u128) <- struct_destructure(v12) + (v10: core::felt252) <- 1 + (v11: core::felt252) <- 4 + (v12: core::felt252) <- 5 + (v13: test::B) <- struct_construct(v0, v5) + (v14: test::A) <- struct_construct(v13, v12) + (v15: core::integer::u32, v16: core::integer::u128) <- struct_destructure(v13) End: - Return(v14, v13, v13) + Return(v15, v14, v14) blk2: Statements: @@ -563,15 +563,15 @@ Statements: (v8: core::bool) <- core::Felt252PartialEq::eq(v4, v7) End: Match(match_enum(v8) { - bool::False(v12) => blk2, + bool::False(v10) => blk2, bool::True(v9) => blk1, }) blk1: Statements: - (v11: core::felt252, v10: core::bool) <- test::foo[38-201](v2) + (v12: core::felt252, v11: core::bool) <- test::foo[38-201](v2) End: - Return(v11, v10) + Return(v12, v11) blk2: Statements: @@ -586,16 +586,16 @@ Statements: (v18: core::bool) <- core::Felt252PartialEq::eq(v14, v17) End: Match(match_enum(v18) { - bool::False(v22) => blk5, + bool::False(v20) => blk5, bool::True(v19) => blk4, }) blk4: Statements: - (v20: ()) <- struct_construct() - (v21: core::bool) <- bool::True(v20) + (v21: ()) <- struct_construct() + (v22: core::bool) <- bool::True(v21) End: - Return(v2, v21) + Return(v2, v22) blk5: Statements: @@ -839,15 +839,15 @@ Statements: (v2: core::bool) <- bool::True(v1) End: Match(match_enum(v2) { - bool::False(v5) => blk2, + bool::False(v4) => blk2, bool::True(v3) => blk1, }) blk1: Statements: - (v4: core::integer::u8) <- 0 + (v5: core::integer::u8) <- 0 End: - Goto(blk3, {v4 -> v7}) + Goto(blk3, {v5 -> v7}) blk2: Statements: @@ -863,15 +863,15 @@ Statements: (v13: core::bool) <- core::integer::U8PartialEq::eq(v9, v12) End: Match(match_enum(v13) { - bool::False(v16) => blk5, + bool::False(v15) => blk5, bool::True(v14) => blk4, }) blk4: Statements: - (v15: ()) <- struct_construct() + (v16: ()) <- struct_construct() End: - Return(v8, v15) + Return(v8, v16) blk5: Statements: @@ -1717,17 +1717,17 @@ Statements: (v8: core::bool) <- core::Felt252PartialEq::eq(v4, v7) End: Match(match_enum(v8) { - bool::False(v13) => blk2, + bool::False(v10) => blk2, bool::True(v9) => blk1, }) blk1: Statements: - (v10: ()) <- struct_construct() - (v11: core::bool) <- bool::True(v10) - (v12: core::internal::LoopResult::) <- LoopResult::Normal(v11) + (v11: ()) <- struct_construct() + (v12: core::bool) <- bool::True(v11) + (v13: core::internal::LoopResult::) <- LoopResult::Normal(v12) End: - Return(v2, v12) + Return(v2, v13) blk2: Statements: @@ -1742,16 +1742,16 @@ Statements: (v19: core::bool) <- core::Felt252PartialEq::eq(v15, v18) End: Match(match_enum(v19) { - bool::False(v23) => blk5, + bool::False(v21) => blk5, bool::True(v20) => blk4, }) blk4: Statements: - (v21: core::integer::u32) <- 5 - (v22: core::internal::LoopResult::) <- LoopResult::EarlyReturn(v21) + (v22: core::integer::u32) <- 5 + (v23: core::internal::LoopResult::) <- LoopResult::EarlyReturn(v22) End: - Return(v2, v22) + Return(v2, v23) blk5: Statements: @@ -1766,15 +1766,15 @@ Statements: (v29: core::bool) <- core::Felt252PartialEq::eq(v25, v28) End: Match(match_enum(v29) { - bool::False(v33) => blk8, + bool::False(v31) => blk8, bool::True(v30) => blk7, }) blk7: Statements: - (v32: core::felt252, v31: core::internal::LoopResult::) <- test::foo[37-253](v2) + (v33: core::felt252, v32: core::internal::LoopResult::) <- test::foo[37-253](v2) End: - Return(v32, v31) + Return(v33, v32) blk8: Statements: @@ -1973,16 +1973,16 @@ Statements: (v4: core::bool) <- core::integer::U32PartialEq::eq(v0, v3) End: Match(match_enum(v4) { - bool::False(v8) => blk2, + bool::False(v6) => blk2, bool::True(v5) => blk1, }) blk1: Statements: - (v6: ()) <- struct_construct() - (v7: core::internal::LoopResult::<(), core::integer::u32>) <- LoopResult::Normal(v6) + (v7: ()) <- struct_construct() + (v8: core::internal::LoopResult::<(), core::integer::u32>) <- LoopResult::Normal(v7) End: - Return(v7) + Return(v8) blk2: Statements: @@ -2148,16 +2148,16 @@ Statements: (v4: core::bool) <- core::integer::U32PartialEq::eq(v0, v3) End: Match(match_enum(v4) { - bool::False(v8) => blk2, + bool::False(v6) => blk2, bool::True(v5) => blk1, }) blk1: Statements: - (v6: ()) <- struct_construct() - (v7: core::internal::LoopResult::<(), core::integer::u32>) <- LoopResult::Normal(v6) + (v7: ()) <- struct_construct() + (v8: core::internal::LoopResult::<(), core::integer::u32>) <- LoopResult::Normal(v7) End: - Return(v7) + Return(v8) blk2: Statements: @@ -2223,7 +2223,7 @@ Statements: (v10: core::bool) <- core::integer::U32PartialEq::eq(v6, v9) End: Match(match_enum(v10) { - bool::False(v14) => blk4, + bool::False(v12) => blk4, bool::True(v11) => blk3, }) @@ -2234,9 +2234,9 @@ End: blk3: Statements: - (v13: core::array::Array::, v12: core::internal::LoopResult::<(), core::integer::u32>) <- test::foo[35-262](v2) + (v14: core::array::Array::, v13: core::internal::LoopResult::<(), core::integer::u32>) <- test::foo[35-262](v2) End: - Return(v13, v12) + Return(v14, v13) blk4: Statements: @@ -2485,16 +2485,16 @@ Statements: (v4: core::bool) <- core::integer::U32PartialEq::eq(v0, v3) End: Match(match_enum(v4) { - bool::False(v8) => blk2, + bool::False(v6) => blk2, bool::True(v5) => blk1, }) blk1: Statements: - (v6: ()) <- struct_construct() - (v7: core::internal::LoopResult::<(), core::integer::u32>) <- LoopResult::Normal(v6) + (v7: ()) <- struct_construct() + (v8: core::internal::LoopResult::<(), core::integer::u32>) <- LoopResult::Normal(v7) End: - Return(v7) + Return(v8) blk2: Statements: @@ -2560,7 +2560,7 @@ Statements: (v10: core::bool) <- core::integer::U32PartialEq::eq(v6, v9) End: Match(match_enum(v10) { - bool::False(v14) => blk4, + bool::False(v12) => blk4, bool::True(v11) => blk3, }) @@ -2571,9 +2571,9 @@ End: blk3: Statements: - (v13: core::array::Array::, v12: core::internal::LoopResult::<(), core::integer::u32>) <- test::foo[35-262](v2) + (v14: core::array::Array::, v13: core::internal::LoopResult::<(), core::integer::u32>) <- test::foo[35-262](v2) End: - Return(v13, v12) + Return(v14, v13) blk4: Statements: diff --git a/crates/cairo-lang-lowering/src/optimizations/test_data/gas_redeposit b/crates/cairo-lang-lowering/src/optimizations/test_data/gas_redeposit index b1d8231ce48..74dcde3384f 100644 --- a/crates/cairo-lang-lowering/src/optimizations/test_data/gas_redeposit +++ b/crates/cairo-lang-lowering/src/optimizations/test_data/gas_redeposit @@ -40,15 +40,15 @@ Statements: (v6: core::bool) <- core::Felt252PartialEq::eq(v2, v5) End: Match(match_enum(v6) { - bool::False(v9) => blk2, + bool::False(v8) => blk2, bool::True(v7) => blk1, }) blk1: Statements: - (v8: core::felt252) <- test::heavy_op1() + (v9: core::felt252) <- test::heavy_op1() End: - Goto(blk3, {v8 -> v11}) + Goto(blk3, {v9 -> v11}) blk2: Statements: @@ -71,15 +71,15 @@ Statements: (v6: core::bool) <- core::Felt252PartialEq::eq(v2, v5) End: Match(match_enum(v6) { - bool::False(v9) => blk2, + bool::False(v8) => blk2, bool::True(v7) => blk1, }) blk1: Statements: - (v8: core::felt252) <- test::heavy_op1() + (v9: core::felt252) <- test::heavy_op1() End: - Goto(blk3, {v8 -> v11}) + Goto(blk3, {v9 -> v11}) blk2: Statements: @@ -134,15 +134,15 @@ Statements: (v6: core::bool) <- core::Felt252PartialEq::eq(v2, v5) End: Match(match_enum(v6) { - bool::False(v9) => blk2, + bool::False(v8) => blk2, bool::True(v7) => blk1, }) blk1: Statements: - (v8: core::felt252) <- test::heavy_op1() + (v9: core::felt252) <- test::heavy_op1() End: - Goto(blk3, {v8 -> v11}) + Goto(blk3, {v9 -> v11}) blk2: Statements: @@ -165,16 +165,16 @@ Statements: (v6: core::bool) <- core::Felt252PartialEq::eq(v2, v5) End: Match(match_enum(v6) { - bool::False(v9) => blk2, + bool::False(v8) => blk2, bool::True(v7) => blk1, }) blk1: Statements: () <- core::gas::redeposit_gas() - (v8: core::felt252) <- test::heavy_op1() + (v9: core::felt252) <- test::heavy_op1() End: - Goto(blk3, {v8 -> v11}) + Goto(blk3, {v9 -> v11}) blk2: Statements: diff --git a/crates/cairo-lang-lowering/src/optimizations/test_data/trim_unreachable b/crates/cairo-lang-lowering/src/optimizations/test_data/trim_unreachable index d59841124ab..9345dc22670 100644 --- a/crates/cairo-lang-lowering/src/optimizations/test_data/trim_unreachable +++ b/crates/cairo-lang-lowering/src/optimizations/test_data/trim_unreachable @@ -121,15 +121,15 @@ Statements: (v7: core::bool) <- core::integer::U32PartialEq::eq(v3, v6) End: Match(match_enum(v7) { - bool::False(v12) => blk2, + bool::False(v9) => blk2, bool::True(v8) => blk1, }) blk1: Statements: - (v9: core::option::Option::) <- core::integer::DowncastableIntTryInto::::try_into(v2) - (v10: core::integer::u16) <- 0 - (v11: core::integer::u16) <- core::option::OptionTraitImpl::::unwrap_or::>(v9, v10) + (v10: core::option::Option::) <- core::integer::DowncastableIntTryInto::::try_into(v2) + (v11: core::integer::u16) <- 0 + (v12: core::integer::u16) <- core::option::OptionTraitImpl::::unwrap_or::>(v10, v11) End: Goto(blk3, {}) @@ -154,9 +154,9 @@ End: blk1: Statements: - (v9: core::option::Option::) <- core::integer::DowncastableIntTryInto::::try_into(v2) - (v10: core::integer::u16) <- 0 - (v11: core::integer::u16) <- core::option::OptionTraitImpl::::unwrap_or::>(v9, v10) + (v10: core::option::Option::) <- core::integer::DowncastableIntTryInto::::try_into(v2) + (v11: core::integer::u16) <- 0 + (v12: core::integer::u16) <- core::option::OptionTraitImpl::::unwrap_or::>(v10, v11) End: Goto(blk3, {}) diff --git a/crates/cairo-lang-sierra-generator/src/statement_location_test_data/simple b/crates/cairo-lang-sierra-generator/src/statement_location_test_data/simple index 21a3ae057cb..9afe27e6f09 100644 --- a/crates/cairo-lang-sierra-generator/src/statement_location_test_data/simple +++ b/crates/cairo-lang-sierra-generator/src/statement_location_test_data/simple @@ -2923,18 +2923,27 @@ if !(array![1, 2] != array![2, 1]) { In function: assert_macro::assert_macro enum_match([25]) { fallthrough([28]) label_test::some_array_checks::3([29]) } Originating location: -if !(array![1, 2] != array![2, 1]) { - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + if !(array![1, 2] != array![2, 1]) { + _^ +| ... +| } +|_^ In function: assert_macro::assert_macro branch_align() -> () Originating location: -if !(array![1, 2] != array![2, 1]) { - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + if !(array![1, 2] != array![2, 1]) { + _^ +| ... +| } +|_^ In function: assert_macro::assert_macro drop([28]) -> () Originating location: -if !(array![1, 2] != array![2, 1]) { - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + if !(array![1, 2] != array![2, 1]) { + _^ +| ... +| } +|_^ In function: assert_macro::assert_macro array_new() -> ([30]) Originating location: @@ -3070,28 +3079,43 @@ Originating location: In function: assert_macro::assert_macro label_test::some_array_checks::3: Originating location: -if !(array![1, 2] != array![2, 1]) { - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + if !(array![1, 2] != array![2, 1]) { + _^ +| ... +| } +|_^ In function: assert_macro::assert_macro branch_align() -> () Originating location: -if !(array![1, 2] != array![2, 1]) { - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + if !(array![1, 2] != array![2, 1]) { + _^ +| ... +| } +|_^ In function: assert_macro::assert_macro drop([29]) -> () Originating location: -if !(array![1, 2] != array![2, 1]) { - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + if !(array![1, 2] != array![2, 1]) { + _^ +| ... +| } +|_^ In function: assert_macro::assert_macro struct_construct() -> ([43]) Originating location: -if !(array![1, 2] != array![2, 1]) { - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + if !(array![1, 2] != array![2, 1]) { + _^ +| ... +| } +|_^ In function: assert_macro::assert_macro struct_construct>([43]) -> ([44]) Originating location: -if !(array![1, 2] != array![2, 1]) { - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + if !(array![1, 2] != array![2, 1]) { + _^ +| ... +| } +|_^ In function: assert_macro::assert_macro enum_init, 0>([44]) -> ([45]) Originating location: