Skip to content

Commit f95b4dc

Browse files
committed
More test fixes - to review
1 parent 1f38d59 commit f95b4dc

File tree

2 files changed

+43
-10
lines changed
  • crates/cairo-lang-lowering/src

2 files changed

+43
-10
lines changed

crates/cairo-lang-lowering/src/borrow_check/test_data/borrow_check

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -995,20 +995,41 @@ End:
995995

996996
blk1:
997997
Statements:
998-
(v2: ()) <- test::foo(v1{`x`})
998+
(v2: core::option::Option::<test::NonDrop>) <- Option::Some(v1{`maybe_consume(x)`})
999999
End:
1000-
Goto(blk3, {v2 -> v3})
1000+
Goto(blk3, {v2 -> v5})
10011001

10021002
blk2:
10031003
Statements:
1004-
(v4: ()) <- struct_construct()
1004+
(v3: ()) <- struct_construct()
1005+
(v4: core::option::Option::<test::NonDrop>) <- Option::None(v3{`maybe_consume(x)`})
10051006
End:
1006-
Goto(blk3, {v4 -> v3})
1007+
Goto(blk3, {v4 -> v5})
10071008

10081009
blk3:
10091010
Statements:
10101011
End:
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
10141035
error: Variable not dropped.

crates/cairo-lang-lowering/src/test_data/if

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)