From 1dd6ea8ad6ed9759f15637fc4f4df3fd56ffbc3a Mon Sep 17 00:00:00 2001 From: Maxim Vezenov Date: Thu, 9 Jan 2025 04:23:37 +0000 Subject: [PATCH 1/2] simplify fetching expr_id for global in monomrphization --- compiler/noirc_frontend/src/monomorphization/mod.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compiler/noirc_frontend/src/monomorphization/mod.rs b/compiler/noirc_frontend/src/monomorphization/mod.rs index ce855f62526..f5cb5a1000c 100644 --- a/compiler/noirc_frontend/src/monomorphization/mod.rs +++ b/compiler/noirc_frontend/src/monomorphization/mod.rs @@ -934,11 +934,9 @@ impl<'interner> Monomorphizer<'interner> { .into_hir_expression(self.interner, global.location) .map_err(MonomorphizationError::InterpreterError)? } else { - let let_ = self.interner.get_global_let_statement(*global_id).expect( - "Globals should have a corresponding let statement by monomorphization", - ); - let_.expression + unreachable!("All global values should be resolved my monomorphization"); }; + self.expr(expr)? } DefinitionKind::Local(_) => match self.lookup_captured_expr(ident.id) { From 3a42872a9758bdacf70d00bf7b8819c5258c9699 Mon Sep 17 00:00:00 2001 From: Maxim Vezenov Date: Thu, 9 Jan 2025 15:33:48 +0000 Subject: [PATCH 2/2] update failure msg --- compiler/noirc_frontend/src/monomorphization/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/noirc_frontend/src/monomorphization/mod.rs b/compiler/noirc_frontend/src/monomorphization/mod.rs index f5cb5a1000c..c3a32f979d4 100644 --- a/compiler/noirc_frontend/src/monomorphization/mod.rs +++ b/compiler/noirc_frontend/src/monomorphization/mod.rs @@ -934,7 +934,7 @@ impl<'interner> Monomorphizer<'interner> { .into_hir_expression(self.interner, global.location) .map_err(MonomorphizationError::InterpreterError)? } else { - unreachable!("All global values should be resolved my monomorphization"); + unreachable!("All global values should be resolved at compile time and before monomorphization"); }; self.expr(expr)?