diff --git a/compiler/noirc_frontend/src/elaborator/mod.rs b/compiler/noirc_frontend/src/elaborator/mod.rs index e0affad1fbf..1c5f791ac38 100644 --- a/compiler/noirc_frontend/src/elaborator/mod.rs +++ b/compiler/noirc_frontend/src/elaborator/mod.rs @@ -248,6 +248,7 @@ impl<'context> Elaborator<'context> { let (comptime_items, runtime_items) = Self::filter_comptime_items(items); this.elaborate_items(comptime_items); this.elaborate_items(runtime_items); + this.check_and_pop_function_context(); this } diff --git a/test_programs/compile_success_empty/trait_call_in_global/Nargo.toml b/test_programs/compile_success_empty/trait_call_in_global/Nargo.toml new file mode 100644 index 00000000000..005fec5bf36 --- /dev/null +++ b/test_programs/compile_success_empty/trait_call_in_global/Nargo.toml @@ -0,0 +1,6 @@ +[package] +name = "trait_call_in_global" +type = "bin" +authors = [""] + +[dependencies] diff --git a/test_programs/compile_success_empty/trait_call_in_global/src/main.nr b/test_programs/compile_success_empty/trait_call_in_global/src/main.nr new file mode 100644 index 00000000000..775cb5f3b7d --- /dev/null +++ b/test_programs/compile_success_empty/trait_call_in_global/src/main.nr @@ -0,0 +1,5 @@ +global s: BoundedVec = From::from([0]); + +fn main() { + let _ = s; +}