From d9d2f3b4b46dd4269f75b06e87790fdf7d5c9354 Mon Sep 17 00:00:00 2001 From: sirasistant Date: Wed, 26 Jul 2023 13:52:30 +0000 Subject: [PATCH] feat: open functions are unconstrained --- crates/noirc_frontend/src/monomorphization/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/noirc_frontend/src/monomorphization/mod.rs b/crates/noirc_frontend/src/monomorphization/mod.rs index 9629254f370..41831de644e 100644 --- a/crates/noirc_frontend/src/monomorphization/mod.rs +++ b/crates/noirc_frontend/src/monomorphization/mod.rs @@ -22,7 +22,7 @@ use crate::{ }, node_interner::{self, DefinitionKind, NodeInterner, StmtId}, token::Attribute, - CompTime, FunctionKind, Type, TypeBinding, TypeBindings, + CompTime, ContractFunctionType, FunctionKind, Type, TypeBinding, TypeBindings, }; use self::ast::{Definition, FuncId, Function, LocalId, Program}; @@ -191,7 +191,8 @@ impl<'interner> Monomorphizer<'interner> { let return_type = Self::convert_type(meta.return_type()); let parameters = self.parameters(meta.parameters); let body = self.expr(*self.interner.function(&f).as_expr()); - let unconstrained = meta.is_unconstrained; + let unconstrained = meta.is_unconstrained + || matches!(meta.contract_function_type, Some(ContractFunctionType::Open)); let function = ast::Function { id, name, parameters, body, return_type, unconstrained }; self.push_function(id, function);