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

fix: pub is required on return for entry points #3616

Merged
merged 7 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions compiler/noirc_frontend/src/hir/resolution/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@

/// True if the current module is a contract.
/// This is usually determined by self.path_resolver.module_id(), but it can
/// be overriden for impls. Impls are an odd case since the methods within resolve

Check warning on line 98 in compiler/noirc_frontend/src/hir/resolution/resolver.rs

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (overriden)
/// as if they're in the parent module, but should be placed in a child module.
/// Since they should be within a child module, in_contract is manually set to false
/// for these so we can still resolve them in the parent module without them being in a contract.
Expand Down Expand Up @@ -790,8 +790,8 @@
});
}

// 'pub_allowed' also implies 'pub' is required on return types
if self.pub_allowed(func)
// 'pub' is required on return types for entry point functions
if self.is_entry_point_function(func)
&& return_type.as_ref() != &Type::Unit
&& func.def.return_visibility != Visibility::Public
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ contract Foo {
open internal fn skibbidy(x: Field) -> pub Field {
x * 5
}
// Regression for issue #3344
#[contract_library_method]
fn foo(x : u8) -> u8 {
x
}
}
Loading