Skip to content

Commit

Permalink
Added NonZero() for const value fmt. (#6424)
Browse files Browse the repository at this point in the history
  • Loading branch information
orizi authored Sep 29, 2024
1 parent eaf8d49 commit 1c651aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Parameters: v0: core::integer::u8
blk0 (root):
Statements:
(v1: core::integer::u8) <- 4
(v2: core::zeroable::NonZero::<core::integer::u8>) <- 4
(v2: core::zeroable::NonZero::<core::integer::u8>) <- NonZero(4)
End:
Goto(blk2, {})

Expand Down Expand Up @@ -477,7 +477,7 @@ Parameters: v0: core::integer::u256
blk0 (root):
Statements:
(v1: core::integer::u256) <- { 4: core::integer::u128, 0: core::integer::u128 }
(v2: core::zeroable::NonZero::<core::integer::u256>) <- { 4: core::integer::u128, 0: core::integer::u128 }
(v2: core::zeroable::NonZero::<core::integer::u256>) <- NonZero({ 4: core::integer::u128, 0: core::integer::u128 })
End:
Goto(blk2, {})

Expand Down Expand Up @@ -719,7 +719,7 @@ blk0 (root):
Statements:
(v1: core::integer::u64) <- 1
(v2: core::integer::u128) <- 1
(v3: core::zeroable::NonZero::<core::integer::u128>) <- 1
(v3: core::zeroable::NonZero::<core::integer::u128>) <- NonZero(1)
End:
Goto(blk2, {})

Expand Down Expand Up @@ -3285,7 +3285,7 @@ Parameters: v0: core::integer::i8
blk0 (root):
Statements:
(v1: core::integer::i8) <- 4
(v2: core::zeroable::NonZero::<core::integer::i8>) <- 4
(v2: core::zeroable::NonZero::<core::integer::i8>) <- NonZero(4)
End:
Goto(blk2, {})

Expand Down
6 changes: 5 additions & 1 deletion crates/cairo-lang-semantic/src/items/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ impl<Db: ?Sized + Upcast<dyn SemanticGroup + 'static>> DebugWithDb<Db> for Const
inner.fmt(f, db)?;
write!(f, ")")
}
ConstValue::NonZero(value) => value.fmt(f, db),
ConstValue::NonZero(value) => {
write!(f, "NonZero(")?;
value.fmt(f, db)?;
write!(f, ")")
}
ConstValue::Boxed(value) => {
value.fmt(f, db)?;
write!(f, ".into_box()")
Expand Down

0 comments on commit 1c651aa

Please sign in to comment.