File tree Expand file tree Collapse file tree 2 files changed +43
-10
lines changed
crates/cairo-lang-lowering/src Expand file tree Collapse file tree 2 files changed +43
-10
lines changed Original file line number Diff line number Diff line change @@ -995,20 +995,41 @@ End:
995995
996996blk1:
997997Statements:
998- (v2: ()) <- test::foo (v1{`x `})
998+ (v2: core::option::Option::<test::NonDrop>) <- Option::Some (v1{`maybe_consume(x) `})
999999End:
1000- Goto(blk3, {v2 -> v3 })
1000+ Goto(blk3, {v2 -> v5 })
10011001
10021002blk2:
10031003Statements:
1004- (v4: ()) <- struct_construct()
1004+ (v3: ()) <- struct_construct()
1005+ (v4: core::option::Option::<test::NonDrop>) <- Option::None(v3{`maybe_consume(x)`})
10051006End:
1006- Goto(blk3, {v4 -> v3 })
1007+ Goto(blk3, {v4 -> v5 })
10071008
10081009blk3:
10091010Statements:
10101011End:
1011- Return(v3)
1012+ Match(match_enum(v5{`maybe_consume(x)`}) {
1013+ Option::Some(v6) => blk4,
1014+ Option::None(v7) => blk5,
1015+ })
1016+
1017+ blk4:
1018+ Statements:
1019+ (v8: ()) <- test::foo(v6{`x`})
1020+ End:
1021+ Goto(blk6, {v8 -> v9})
1022+
1023+ blk5:
1024+ Statements:
1025+ (v10: ()) <- struct_construct()
1026+ End:
1027+ Goto(blk6, {v10 -> v9})
1028+
1029+ blk6:
1030+ Statements:
1031+ End:
1032+ Return(v9)
10121033
10131034//! > lowering_diagnostics
10141035error: Variable not dropped.
Original file line number Diff line number Diff line change @@ -751,13 +751,25 @@ struct MyStruct {
751751//! > semantic_diagnostics
752752
753753//! > lowering_diagnostics
754- error: Unsupported type in if-let. Type: `test::MyStruct`.
755- --> lib.cairo:7:16
756- if let _ = a {
757- ^
754+ warning: Unreachable clause.
755+ --> lib.cairo:10:12-12:5
756+ } else {
757+ ____________^
758+ | y = y + 8;
759+ | }
760+ |_____^
758761
759762//! > lowering_flat
760- <Failed lowering function - run with RUST_LOG=warn (or less) to see diagnostics>
763+ Parameters: v0: test::MyStruct
764+ blk0 (root):
765+ Statements:
766+ (v1: core::felt252) <- 0
767+ (v2: core::felt252) <- 5
768+ (v3: core::felt252) <- core::felt252_add(v1, v2)
769+ (v4: core::felt252) <- 1
770+ (v5: core::felt252) <- core::felt252_add(v3, v4)
771+ End:
772+ Return(v5)
761773
762774//! > ==========================================================================
763775
You can’t perform that action at this time.
0 commit comments