From 3d1e45680b07e3c98432b7bfb8ff32c4437dc5f8 Mon Sep 17 00:00:00 2001 From: Michael J Klein Date: Wed, 20 Mar 2024 16:18:51 -0400 Subject: [PATCH] chore: regression test for #2540 (#4602) # Description ## Problem\* Resolves https://github.com/noir-lang/noir/issues/2540 ## Summary\* Fixed in https://github.com/noir-lang/noir/pull/4504 ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- compiler/noirc_frontend/src/tests.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/compiler/noirc_frontend/src/tests.rs b/compiler/noirc_frontend/src/tests.rs index 98dbc42adcd..6f92cb52a88 100644 --- a/compiler/noirc_frontend/src/tests.rs +++ b/compiler/noirc_frontend/src/tests.rs @@ -1256,6 +1256,22 @@ fn lambda$f1(mut env$l1: (Field)) -> Field { assert_eq!(get_program_errors(src).len(), 2); } + // Regression for #2540 + #[test] + fn for_loop_over_array() { + let src = r#" + fn hello(_array: [u1; N]) { + for _ in 0..N {} + } + + fn main() { + let array: [u1; 2] = [0, 1]; + hello(array); + } + "#; + assert_eq!(get_program_errors(src).len(), 0); + } + // Regression for #4545 #[test] fn type_aliases_in_main() {