Skip to content
Merged
Changes from 2 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
5 changes: 4 additions & 1 deletion compiler/noirc_frontend/src/ownership/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,10 @@ impl Context {
self.handle_reference_expression(&mut index.collection);
self.handle_expression(&mut index.index);

if contains_array_or_str_type(&index.element_type) {
// We do not need to clone the result of a function call.
// The appropriate cloning should be handled by the function internally or the caller of the function.
let is_call = matches!(*index.collection, Expression::Call(_));
if !is_call && contains_array_or_str_type(&index.element_type) {
clone_expr(index_expr);
}
}
Expand Down
Loading