diff --git a/compiler/noirc_evaluator/src/ssa/opt/defunctionalize.rs b/compiler/noirc_evaluator/src/ssa/opt/defunctionalize.rs index 2c6bc64a39a..110b029a6ae 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/defunctionalize.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/defunctionalize.rs @@ -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. //! @@ -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 @@ -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]; @@ -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 diff --git a/test_programs/execution_panic/regression_10117/Nargo.toml b/test_programs/execution_panic/regression_10117/Nargo.toml new file mode 100644 index 00000000000..dfc04d2e21b --- /dev/null +++ b/test_programs/execution_panic/regression_10117/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "regression_10117" +type = "bin" +authors = [""] + +[dependencies] \ No newline at end of file diff --git a/test_programs/execution_panic/regression_10117/src/main.nr b/test_programs/execution_panic/regression_10117/src/main.nr new file mode 100644 index 00000000000..a191f3f0f50 --- /dev/null +++ b/test_programs/execution_panic/regression_10117/src/main.nr @@ -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) +} \ No newline at end of file