Skip to content
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
6 changes: 4 additions & 2 deletions compiler/noirc_frontend/src/elaborator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,8 @@ impl<'context> Elaborator<'context> {
let name_ident = HirIdent::non_trait_method(id, location);

let is_entry_point = self.is_entry_point_function(func, in_contract);
let is_test_or_fuzz =
func.attributes().is_test_function() || func.attributes().is_fuzzing_harness();

// Both the #[fold] and #[no_predicates] alter a function's inline type and code generation in similar ways.
// In certain cases such as type checking (for which the following flag will be used) both attributes
Expand Down Expand Up @@ -993,12 +995,12 @@ impl<'context> Elaborator<'context> {

self.check_if_type_is_valid_for_program_input(
&typ,
is_entry_point,
is_entry_point || is_test_or_fuzz,
has_inline_attribute,
type_location,
);

if is_entry_point {
if is_entry_point || is_test_or_fuzz {
self.mark_type_as_used(&typ);
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/type_check/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ impl<'a> From<&'a TypeCheckError> for Diagnostic {
}
TypeCheckError::InvalidTypeForEntryPoint { location } => Diagnostic::simple_error(
"Only sized types may be used in the entry point to a program".to_string(),
"Slices, references, or any type containing them may not be used in main, contract functions, or foldable functions".to_string(), *location),
"Slices, references, or any type containing them may not be used in main, contract functions, test functions, fuzz functions or foldable functions".to_string(), *location),
TypeCheckError::MismatchTraitImplNumParameters {
expected_num_parameters,
actual_num_parameters,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "test_invalid_argument_type"
type = "bin"
authors = [""]
compiler_version = ">=0.33.0"

[dependencies]
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {}

#[test]
fn test(_arg: &mut i32) {}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading