From bdcfdf218d5e95c0c21e73a13b3ff620323da9cd Mon Sep 17 00:00:00 2001 From: jfecher Date: Tue, 28 Mar 2023 22:45:34 +0100 Subject: [PATCH] chore: Add unconstrained to monomorphized functions (#1057) Add unconstrained to monomorphized Functions --- crates/noirc_frontend/src/monomorphization/ast.rs | 1 + crates/noirc_frontend/src/monomorphization/mod.rs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/noirc_frontend/src/monomorphization/ast.rs b/crates/noirc_frontend/src/monomorphization/ast.rs index 662737b4f97..7cb6f5ef5bc 100644 --- a/crates/noirc_frontend/src/monomorphization/ast.rs +++ b/crates/noirc_frontend/src/monomorphization/ast.rs @@ -184,6 +184,7 @@ pub struct Function { pub body: Expression, pub return_type: Type, + pub unconstrained: bool, } /// Compared to hir_def::types::Type, this monomorphized Type has: diff --git a/crates/noirc_frontend/src/monomorphization/mod.rs b/crates/noirc_frontend/src/monomorphization/mod.rs index 92506ad294d..961cfd18320 100644 --- a/crates/noirc_frontend/src/monomorphization/mod.rs +++ b/crates/noirc_frontend/src/monomorphization/mod.rs @@ -180,8 +180,9 @@ impl<'interner> Monomorphizer<'interner> { let return_type = Self::convert_type(meta.return_type()); let parameters = self.parameters(meta.parameters); let body = self.expr_infer(*self.interner.function(&f).as_expr()); + let unconstrained = meta.is_unconstrained; - let function = ast::Function { id, name, parameters, body, return_type }; + let function = ast::Function { id, name, parameters, body, return_type, unconstrained }; self.push_function(id, function); } @@ -742,8 +743,9 @@ impl<'interner> Monomorphizer<'interner> { let id = self.next_function_id(); let return_type = ret_type.clone(); let name = lambda_name.to_owned(); + let unconstrained = false; - let function = ast::Function { id, name, parameters, body, return_type }; + let function = ast::Function { id, name, parameters, body, return_type, unconstrained }; self.push_function(id, function); let typ = ast::Type::Function(parameter_types, Box::new(ret_type));