Skip to content

Commit

Permalink
chore(aztec_noir): imply the open keyword (#2508)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 authored Aug 31, 2023
1 parent 825600a commit c344d86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions crates/noirc_frontend/src/hir/def_map/aztec_library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,11 @@ fn transform_function(ty: &str, func: &mut NoirFunction) {
func.def.return_visibility = Visibility::Public;

// Distinct return types are only required for private functions
if ty == "Private" {
func.def.return_distinctness = Distinctness::Distinct;
// Public functions should have open auto-inferred
match ty {
"Private" => func.def.return_distinctness = Distinctness::Distinct,
"Public" => func.def.is_open = true,
_ => (),
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/noirc_frontend/src/hir/def_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl CrateDefMap {
let ast = parse_file(&mut context.file_manager, root_file_id, errors);

#[cfg(feature = "aztec")]
let ast = aztec_library::transform(ast);
let ast = aztec_library::transform(ast, &crate_id, context, errors);

// Allocate a default Module for the root, giving it a ModuleId
let mut modules: Arena<ModuleData> = Arena::default();
Expand Down

0 comments on commit c344d86

Please sign in to comment.