Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions compiler/noirc_evaluator/src/ssa/interpreter/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,11 @@
Value::ArrayOrSlice(array) if array.is_slice => {
Type::Slice(array.element_types.clone())
}
Value::ArrayOrSlice(array) => Type::Array(
array.element_types.clone(),
if array.element_types.len() == 0 {
0
} else {
(array.elements.borrow().len() / array.element_types.len()) as u32
},
),
Value::ArrayOrSlice(array) => {
let len = array.elements.borrow().len().checked_div(array.element_types.len());
let len = len.unwrap_or(0) as u32;
Type::Array(array.element_types.clone(), len)
}
Value::Function(_) | Value::Intrinsic(_) | Value::ForeignFunction(_) => Type::Function,
}
}
Expand Down Expand Up @@ -182,7 +179,7 @@

/// Return an uninitialized value of the given type. This is usually a zeroed
/// value but we make no guarantee that it is. This is often used as the default
/// value to return for side-effectful functions like `call` or `array_get` when

Check warning on line 182 in compiler/noirc_evaluator/src/ssa/interpreter/value.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (effectful)
/// side-effects are disabled.
pub(crate) fn uninitialized(typ: &Type, id: ValueId) -> Value {
match typ {
Expand Down
Loading