Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions compiler/noirc_evaluator/src/ssa/opt/defunctionalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! by transforming functions used as values (i.e., first-class functions)
//! into constant numbers (fields) that represent their function IDs.
//!
//! Defunctionalization handles higher-order functions functions by lowering function values into
//! Defunctionalization handles higher-order functions by lowering function values into
//! constant identifiers and replacing calls of function values with calls to a single
//! dispatch `apply` function.
//!
Expand Down Expand Up @@ -126,7 +126,7 @@ impl DefunctionalizationContext {
// We mutate value types in `defunctionalize`, so to prevent that from affecting which
// apply functions are chosen we replace all first-class function calls with calls to
// the appropriate apply function beforehand.
self.replace_fist_class_calls_with_apply_function(function);
self.replace_first_class_calls_with_apply_function(function);

// Replace any first-class function values with field values. This will also mutate the
// type of some values, such as block arguments
Expand All @@ -137,7 +137,7 @@ impl DefunctionalizationContext {
/// Replaces any function calls using first-class function values with calls to the
/// appropriate `apply` function. Note that this must be done before types are mutated
/// in `defunctionalize` since this uses the pre-mutated types to query apply functions.
fn replace_fist_class_calls_with_apply_function(&mut self, func: &mut Function) {
fn replace_first_class_calls_with_apply_function(&mut self, func: &mut Function) {
for block_id in func.reachable_blocks() {
let block = &mut func.dfg[block_id];

Expand Down Expand Up @@ -496,7 +496,7 @@ fn create_apply_functions(
} else if pre_runtime_filter_len != 0 && caller_runtime.is_brillig() {
// We had variants, but they were all filtered out.
// Frontend bug: only ACIR variants in a Brillig group.
panic!("ICE: invalid defunctionalization: only ACIR variants for a Brillig runtime",);
panic!("ICE: invalid defunctionalization: only ACIR variants for a Brillig runtime");
} else {
// If no variants exist for a dynamic call we leave removing those dead calls and parameters to DIE.
// However, we have to construct a dummy function for these dead calls as to keep a well formed SSA
Expand Down
6 changes: 6 additions & 0 deletions test_programs/execution_panic/regression_10117/Nargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "regression_10117"
type = "bin"
authors = [""]

[dependencies]
8 changes: 8 additions & 0 deletions test_programs/execution_panic/regression_10117/src/main.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fn main(input: [u8; 1]) -> pub [u8; 32] {
let fun = if input[0] == 0 {
std::hash::blake2s
} else {
|_| [0_u8; 32]
};
fun(input)
}
Loading