diff --git a/compiler/noirc_frontend/src/ast/mod.rs b/compiler/noirc_frontend/src/ast/mod.rs index fe9153c2cf4..94e81b19582 100644 --- a/compiler/noirc_frontend/src/ast/mod.rs +++ b/compiler/noirc_frontend/src/ast/mod.rs @@ -460,6 +460,7 @@ impl UnresolvedTypeExpression { ExpressionKind::AsTraitPath(path) => { Ok(UnresolvedTypeExpression::AsTraitPath(Box::new(path))) } + ExpressionKind::Parenthesized(expr) => Self::from_expr_helper(*expr), _ => Err(expr), } } diff --git a/test_programs/compile_success_empty/parenthesized_expression_in_array_length/Nargo.toml b/test_programs/compile_success_empty/parenthesized_expression_in_array_length/Nargo.toml new file mode 100644 index 00000000000..e56e9643f40 --- /dev/null +++ b/test_programs/compile_success_empty/parenthesized_expression_in_array_length/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "parenthesized_expression_in_array_length" +type = "bin" +authors = [""] +compiler_version = ">=0.32.0" + +[dependencies] \ No newline at end of file diff --git a/test_programs/compile_success_empty/parenthesized_expression_in_array_length/src/main.nr b/test_programs/compile_success_empty/parenthesized_expression_in_array_length/src/main.nr new file mode 100644 index 00000000000..b596d331e7f --- /dev/null +++ b/test_programs/compile_success_empty/parenthesized_expression_in_array_length/src/main.nr @@ -0,0 +1,6 @@ +global N = 100; +global BLOCK_SIZE = 10; + +fn main() { + let _: [Field; 110] = [0; ((N + BLOCK_SIZE) * BLOCK_SIZE) / BLOCK_SIZE]; +}