Skip to content

Commit

Permalink
chore: Add unconstrained to monomorphized functions (#1057)
Browse files Browse the repository at this point in the history
Add unconstrained to monomorphized Functions
  • Loading branch information
jfecher authored Mar 28, 2023
1 parent dadbd3c commit bdcfdf2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions crates/noirc_frontend/src/monomorphization/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions crates/noirc_frontend/src/monomorphization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit bdcfdf2

Please sign in to comment.