Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add unconstrained to monomorphized functions #1057

Merged
merged 1 commit into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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