From 2f7ba92ced1f6a8efed64dbf9d7bad3ee5003203 Mon Sep 17 00:00:00 2001 From: Todd Nowacki Date: Fri, 8 Apr 2022 13:48:44 -0700 Subject: [PATCH] [move-compiler] Remove script function checks - Removed script signature checks - Return values in scripts still not supported - Updated tests Closes: #206 --- .../move-compiler/src/typing/translate.rs | 126 +++--------------- .../move/signer/address_arg_is_not_signer.exp | 28 +--- .../signer/address_arg_is_not_signer.move | 2 + .../move/signer/double_signer.exp | 8 -- .../move/signer/double_signer.move | 4 +- .../move/signer/misplaced_signer_arg.exp | 16 --- .../move/signer/misplaced_signer_arg.move | 4 +- .../move/signer/triple_signer.exp | 24 ---- .../move/signer/triple_signer.move | 1 + .../typing/main_arguments_invalid.exp | 80 ----------- ....move => main_arguments_various_caes.move} | 2 +- .../typing/main_return_type_invalid.move | 5 - ...alid.exp => main_return_type_not_unit.exp} | 4 +- .../typing/main_return_type_not_unit.move | 7 + ...> public_script_signature_no_warning.move} | 2 +- .../public_script_signature_warning.exp | 42 ------ 16 files changed, 40 insertions(+), 315 deletions(-) delete mode 100644 language/move-compiler/tests/move_check/translated_ir_tests/move/signer/double_signer.exp delete mode 100644 language/move-compiler/tests/move_check/translated_ir_tests/move/signer/misplaced_signer_arg.exp delete mode 100644 language/move-compiler/tests/move_check/translated_ir_tests/move/signer/triple_signer.exp delete mode 100644 language/move-compiler/tests/move_check/typing/main_arguments_invalid.exp rename language/move-compiler/tests/move_check/typing/{main_arguments_invalid.move => main_arguments_various_caes.move} (81%) delete mode 100644 language/move-compiler/tests/move_check/typing/main_return_type_invalid.move rename language/move-compiler/tests/move_check/typing/{main_return_type_invalid.exp => main_return_type_not_unit.exp} (72%) create mode 100644 language/move-compiler/tests/move_check/typing/main_return_type_not_unit.move rename language/move-compiler/tests/move_check/typing/{public_script_signature_warning.move => public_script_signature_no_warning.move} (80%) delete mode 100644 language/move-compiler/tests/move_check/typing/public_script_signature_warning.exp diff --git a/language/move-compiler/src/typing/translate.rs b/language/move-compiler/src/typing/translate.rs index 2a85ada43d..b36d784a32 100644 --- a/language/move-compiler/src/typing/translate.rs +++ b/language/move-compiler/src/typing/translate.rs @@ -10,9 +10,7 @@ use crate::{ diagnostics::{codes::*, Diagnostic}, expansion::ast::{Fields, ModuleIdent, Value_}, naming::ast::{self as N, TParam, TParamID, Type, TypeName_, Type_}, - parser::ast::{ - Ability_, BinOp_, ConstantName, Field, FunctionName, StructName, UnaryOp_, Var, Visibility, - }, + parser::ast::{Ability_, BinOp_, ConstantName, Field, FunctionName, StructName, UnaryOp_, Var}, shared::{unique_map::UniqueMap, *}, typing::ast as T, FullyCompiledProgram, @@ -117,61 +115,6 @@ fn script(context: &mut Context, nscript: N::Script) -> T::Script { } } -#[derive(Clone, Copy)] -// enum representing the case for functions that are invocable by the VM script API -enum Invocable { - // a normal script block - Script, - // a public(script) function in a module - PublicScript, -} - -fn check_primitive_script_arg( - context: &mut Context, - case: Invocable, - mloc: Loc, - seen_non_signer: &mut bool, - ty: &Type, -) { - let current_function = context.current_function.unwrap(); - let mk_msg = move || { - format!( - "Invalid parameter for script function '{}'", - current_function - ) - }; - let code = match case { - Invocable::Script => TypeSafety::ScriptSignature, - Invocable::PublicScript => TypeSafety::NonInvocablePublicScript, - }; - - let loc = ty.loc; - let signer = Type_::signer(loc); - let is_signer = { - let old_subst = context.subst.clone(); - let result = subtype_no_report(context, ty.clone(), signer.clone()); - context.subst = old_subst; - result.is_ok() - }; - if is_signer { - if *seen_non_signer { - let msg = mk_msg(); - let tmsg = format!( - "{}s must be a prefix of the arguments to a script--they must come before any \ - non-signer types", - core::error_format(&signer, &Subst::empty()), - ); - context.env.add_diag(diag!(code, (mloc, msg), (loc, tmsg))); - } - - return; - } else { - *seen_non_signer = true; - } - - check_valid_constant::signature(context, mloc, mk_msg, code, ty); -} - //************************************************************************************************** // Functions //************************************************************************************************** @@ -193,58 +136,23 @@ fn function( assert!(context.constraints.is_empty()); context.reset_for_module_item(); context.current_function = Some(name); - let invocable_opt = match (is_script, &visibility) { - (true, _) => Some(Invocable::Script), - (_, Visibility::Script(_)) => Some(Invocable::PublicScript), - _ => None, - }; - function_signature(context, &signature); - if let Some(case) = invocable_opt { - let mut seen_non_signer = false; - for (_, param_ty) in signature.parameters.iter() { - check_primitive_script_arg(context, case, loc, &mut seen_non_signer, param_ty); - } - match case { - Invocable::Script => { - subtype( - context, - loc, - || { - let tu = core::error_format_(&Type_::Unit, &Subst::empty()); - format!( - "Invalid 'script' function return type. The function entry point to a \ - 'script' must have the return type {}", - tu - ) - }, - signature.return_type.clone(), - sp(loc, Type_::Unit), - ); - } - Invocable::PublicScript => { - let res = - subtype_no_report(context, signature.return_type.clone(), sp(loc, Type_::Unit)); - if let Err(err) = res { - let mut diag = typing_error( - context, - true, - loc, - || { - let tu = core::error_format_(&Type_::Unit, &Subst::empty()); - format!( - "'public(script)' functions must have a return type of {} in \ - order to be invocable as a script entry point", - tu, - ) - }, - err, - ); - diag = diag.set_code(TypeSafety::NonInvocablePublicScript); - context.env.add_diag(diag) - } - } - } + if is_script { + let mk_msg = || { + let tu = core::error_format_(&Type_::Unit, &Subst::empty()); + format!( + "Invalid 'script' function return type. The function entry point to a \ + 'script' must have the return type {}", + tu + ) + }; + subtype( + context, + loc, + mk_msg, + signature.return_type.clone(), + sp(loc, Type_::Unit), + ); } expand::function_signature(context, &mut signature); diff --git a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.exp b/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.exp index b5270d5b26..c779dd383d 100644 --- a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.exp +++ b/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.exp @@ -1,41 +1,25 @@ error[E05001]: ability constraint not satisfied - ┌─ tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.move:3:27 + ┌─ tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.move:5:27 │ -3 │ struct R has key { s: signer } +5 │ struct R has key { s: signer } │ ^^^^^^ │ │ │ Invalid field type. The struct was declared with the ability 'key' so all fields require the ability 'store' │ The type 'signer' does not have the ability 'store' -error[E04011]: invalid script signature - ┌─ tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.move:11:9 - │ -11 │ fun t1(s: &signer) { - │ ^^ ------- Found: '&signer'. But expected one of: 'u8', 'u64', 'u128', 'bool', 'address', 'vector<_>' - │ │ - │ Invalid parameter for script function 't1' - error[E04016]: too few arguments - ┌─ tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.move:12:9 + ┌─ tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.move:14:9 │ -12 │ 0x2::M::store_signer(s) +14 │ 0x2::M::store_signer(s) │ ^^^^^^^^^^^^^^^^^^^^^^^ │ │ │ │ │ Found 1 argument(s) here │ Invalid call of '0x2::M::store_signer'. The call expected 2 argument(s) but got 1 -error[E04011]: invalid script signature - ┌─ tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.move:18:9 - │ -18 │ fun t2(_s: signer, s2: &signer) { - │ ^^ ------- Found: '&signer'. But expected one of: 'u8', 'u64', 'u128', 'bool', 'address', 'vector<_>' - │ │ - │ Invalid parameter for script function 't2' - error[E04016]: too few arguments - ┌─ tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.move:19:9 + ┌─ tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.move:21:9 │ -19 │ 0x2::M::store_signer(s2) +21 │ 0x2::M::store_signer(s2) │ ^^^^^^^^^^^^^^^^^^^^^^^^ │ │ │ │ │ Found 1 argument(s) here diff --git a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.move b/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.move index 3b629a2126..77527f3ab1 100644 --- a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.move +++ b/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/address_arg_is_not_signer.move @@ -1,3 +1,5 @@ +// script functions no longer have any built in checks outside of visibility rules + address 0x2 { module M { struct R has key { s: signer } diff --git a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/double_signer.exp b/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/double_signer.exp deleted file mode 100644 index 5cb7390d0a..0000000000 --- a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/double_signer.exp +++ /dev/null @@ -1,8 +0,0 @@ -error[E04011]: invalid script signature - ┌─ tests/move_check/translated_ir_tests/move/signer/double_signer.move:15:9 - │ -15 │ fun t2(_s: signer, _u: u64, _s2: signer) { - │ ^^ ------ 'signer's must be a prefix of the arguments to a script--they must come before any non-signer types - │ │ - │ Invalid parameter for script function 't2' - diff --git a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/double_signer.move b/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/double_signer.move index be0130e21e..2466020082 100644 --- a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/double_signer.move +++ b/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/double_signer.move @@ -1,18 +1,16 @@ +// script functions no longer have any built in checks outside of visibility rules script { fun t0(_s: signer, _s2: signer) { } } -// check: INVALID_MAIN_FUNCTION_SIGNATURE script { fun t1(_s: signer, _s2: signer, _u: u64) { } } -// check: INVALID_MAIN_FUNCTION_SIGNATURE script { fun t2(_s: signer, _u: u64, _s2: signer) { } } -// check: INVALID_MAIN_FUNCTION_SIGNATURE diff --git a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/misplaced_signer_arg.exp b/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/misplaced_signer_arg.exp deleted file mode 100644 index 1e7a929d6e..0000000000 --- a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/misplaced_signer_arg.exp +++ /dev/null @@ -1,16 +0,0 @@ -error[E04011]: invalid script signature - ┌─ tests/move_check/translated_ir_tests/move/signer/misplaced_signer_arg.move:2:9 - │ -2 │ fun t0(_u: u64, _s: signer) { - │ ^^ ------ 'signer's must be a prefix of the arguments to a script--they must come before any non-signer types - │ │ - │ Invalid parameter for script function 't0' - -error[E04011]: invalid script signature - ┌─ tests/move_check/translated_ir_tests/move/signer/misplaced_signer_arg.move:8:9 - │ -8 │ fun t1(_u: u64, _s: signer, _u2: u64) { - │ ^^ ------ 'signer's must be a prefix of the arguments to a script--they must come before any non-signer types - │ │ - │ Invalid parameter for script function 't1' - diff --git a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/misplaced_signer_arg.move b/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/misplaced_signer_arg.move index ce8a0bf38a..f108013233 100644 --- a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/misplaced_signer_arg.move +++ b/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/misplaced_signer_arg.move @@ -1,11 +1,11 @@ +// script functions no longer have any built in checks outside of visibility rules + script { fun t0(_u: u64, _s: signer) { } } -// check: INVALID_MAIN_FUNCTION_SIGNATURE script { fun t1(_u: u64, _s: signer, _u2: u64) { } } -// check: INVALID_MAIN_FUNCTION_SIGNATURE diff --git a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/triple_signer.exp b/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/triple_signer.exp deleted file mode 100644 index 818aa279ab..0000000000 --- a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/triple_signer.exp +++ /dev/null @@ -1,24 +0,0 @@ -error[E04011]: invalid script signature - ┌─ tests/move_check/translated_ir_tests/move/signer/triple_signer.move:13:9 - │ -13 │ fun t1(_s: signer, _s2: signer, _u: u64, _s3: signer) { - │ ^^ ------ 'signer's must be a prefix of the arguments to a script--they must come before any non-signer types - │ │ - │ Invalid parameter for script function 't1' - -error[E04011]: invalid script signature - ┌─ tests/move_check/translated_ir_tests/move/signer/triple_signer.move:18:9 - │ -18 │ fun t2(_u: u64, _s2: signer) { - │ ^^ ------ 'signer's must be a prefix of the arguments to a script--they must come before any non-signer types - │ │ - │ Invalid parameter for script function 't2' - -error[E04011]: invalid script signature - ┌─ tests/move_check/translated_ir_tests/move/signer/triple_signer.move:23:9 - │ -23 │ fun t2(_s: signer, _u: u64, _s2: signer) { - │ ^^ ------ 'signer's must be a prefix of the arguments to a script--they must come before any non-signer types - │ │ - │ Invalid parameter for script function 't2' - diff --git a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/triple_signer.move b/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/triple_signer.move index 34c42c13b8..6acb1df050 100644 --- a/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/triple_signer.move +++ b/language/move-compiler/tests/move_check/translated_ir_tests/move/signer/triple_signer.move @@ -1,3 +1,4 @@ +// script functions no longer have any built in checks outside of visibility rules script { fun t0(_s: signer, _s2: signer, _s3: signer) { diff --git a/language/move-compiler/tests/move_check/typing/main_arguments_invalid.exp b/language/move-compiler/tests/move_check/typing/main_arguments_invalid.exp deleted file mode 100644 index 624e20f72e..0000000000 --- a/language/move-compiler/tests/move_check/typing/main_arguments_invalid.exp +++ /dev/null @@ -1,80 +0,0 @@ -error[E04011]: invalid script signature - ┌─ tests/move_check/typing/main_arguments_invalid.move:16:5 - │ -16 │ fun main( - │ ^^^^ Invalid parameter for script function 'main' -17 │ _s: &signer, - │ ------- Found: '&signer'. But expected one of: 'u8', 'u64', 'u128', 'bool', 'address', 'vector<_>' - -error[E04011]: invalid script signature - ┌─ tests/move_check/typing/main_arguments_invalid.move:16:5 - │ -16 │ fun main( - │ ^^^^ Invalid parameter for script function 'main' -17 │ _s: &signer, -18 │ _a0: T, - │ - Found: 'T'. But expected one of: 'u8', 'u64', 'u128', 'bool', 'address', 'vector<_>' - -error[E04011]: invalid script signature - ┌─ tests/move_check/typing/main_arguments_invalid.move:16:5 - │ -16 │ fun main( - │ ^^^^ Invalid parameter for script function 'main' - · -19 │ _a1: vector, - │ - Found: 'T'. But expected one of: 'u8', 'u64', 'u128', 'bool', 'address', 'vector<_>' - -error[E04011]: invalid script signature - ┌─ tests/move_check/typing/main_arguments_invalid.move:16:5 - │ -16 │ fun main( - │ ^^^^ Invalid parameter for script function 'main' - · -20 │ _a2: vector>, - │ - Found: 'T'. But expected one of: 'u8', 'u64', 'u128', 'bool', 'address', 'vector<_>' - -error[E04011]: invalid script signature - ┌─ tests/move_check/typing/main_arguments_invalid.move:16:5 - │ -16 │ fun main( - │ ^^^^ Invalid parameter for script function 'main' - · -21 │ _a3: S, - │ - Found: '0x42::M::S'. But expected one of: 'u8', 'u64', 'u128', 'bool', 'address', 'vector<_>' - -error[E04011]: invalid script signature - ┌─ tests/move_check/typing/main_arguments_invalid.move:16:5 - │ -16 │ fun main( - │ ^^^^ Invalid parameter for script function 'main' - · -22 │ _a4: R, - │ - Found: '0x42::M::R'. But expected one of: 'u8', 'u64', 'u128', 'bool', 'address', 'vector<_>' - -error[E04011]: invalid script signature - ┌─ tests/move_check/typing/main_arguments_invalid.move:16:5 - │ -16 │ fun main( - │ ^^^^ Invalid parameter for script function 'main' - · -23 │ _a5: Cup, - │ ------- Found: '0x42::M::Cup'. But expected one of: 'u8', 'u64', 'u128', 'bool', 'address', 'vector<_>' - -error[E04011]: invalid script signature - ┌─ tests/move_check/typing/main_arguments_invalid.move:16:5 - │ -16 │ fun main( - │ ^^^^ Invalid parameter for script function 'main' - · -24 │ _a6: Cup, - │ ------ Found: '0x42::M::Cup'. But expected one of: 'u8', 'u64', 'u128', 'bool', 'address', 'vector<_>' - -error[E04011]: invalid script signature - ┌─ tests/move_check/typing/main_arguments_invalid.move:16:5 - │ -16 │ fun main( - │ ^^^^ Invalid parameter for script function 'main' - · -25 │ _a7: vector, - │ - Found: '0x42::M::S'. But expected one of: 'u8', 'u64', 'u128', 'bool', 'address', 'vector<_>' - diff --git a/language/move-compiler/tests/move_check/typing/main_arguments_invalid.move b/language/move-compiler/tests/move_check/typing/main_arguments_various_caes.move similarity index 81% rename from language/move-compiler/tests/move_check/typing/main_arguments_invalid.move rename to language/move-compiler/tests/move_check/typing/main_arguments_various_caes.move index ec05c2cda9..6755f14ddc 100644 --- a/language/move-compiler/tests/move_check/typing/main_arguments_invalid.move +++ b/language/move-compiler/tests/move_check/typing/main_arguments_various_caes.move @@ -12,7 +12,7 @@ module M { script { use 0x42::M::{S, R, Cup}; - +// script functions no longer have any built in checks outside of visibility rules fun main( _s: &signer, _a0: T, diff --git a/language/move-compiler/tests/move_check/typing/main_return_type_invalid.move b/language/move-compiler/tests/move_check/typing/main_return_type_invalid.move deleted file mode 100644 index 7d720cd58f..0000000000 --- a/language/move-compiler/tests/move_check/typing/main_return_type_invalid.move +++ /dev/null @@ -1,5 +0,0 @@ -script { -fun main(): u64 { - 0 -} -} diff --git a/language/move-compiler/tests/move_check/typing/main_return_type_invalid.exp b/language/move-compiler/tests/move_check/typing/main_return_type_not_unit.exp similarity index 72% rename from language/move-compiler/tests/move_check/typing/main_return_type_invalid.exp rename to language/move-compiler/tests/move_check/typing/main_return_type_not_unit.exp index 2465abd4ce..991ffdab88 100644 --- a/language/move-compiler/tests/move_check/typing/main_return_type_invalid.exp +++ b/language/move-compiler/tests/move_check/typing/main_return_type_not_unit.exp @@ -1,7 +1,7 @@ error[E04007]: incompatible types - ┌─ tests/move_check/typing/main_return_type_invalid.move:2:5 + ┌─ tests/move_check/typing/main_return_type_not_unit.move:4:5 │ -2 │ fun main(): u64 { +4 │ fun main(): u64 { │ ^^^^ --- Given: 'u64' │ │ │ Invalid 'script' function return type. The function entry point to a 'script' must have the return type '()' diff --git a/language/move-compiler/tests/move_check/typing/main_return_type_not_unit.move b/language/move-compiler/tests/move_check/typing/main_return_type_not_unit.move new file mode 100644 index 0000000000..39ffdec218 --- /dev/null +++ b/language/move-compiler/tests/move_check/typing/main_return_type_not_unit.move @@ -0,0 +1,7 @@ +script { +// despite script functions no longer have any built in checks, +// scripts still do not support return values +fun main(): u64 { + 0 +} +} diff --git a/language/move-compiler/tests/move_check/typing/public_script_signature_warning.move b/language/move-compiler/tests/move_check/typing/public_script_signature_no_warning.move similarity index 80% rename from language/move-compiler/tests/move_check/typing/public_script_signature_warning.move rename to language/move-compiler/tests/move_check/typing/public_script_signature_no_warning.move index 890c6a3719..0c70f7f0d5 100644 --- a/language/move-compiler/tests/move_check/typing/public_script_signature_warning.move +++ b/language/move-compiler/tests/move_check/typing/public_script_signature_no_warning.move @@ -2,7 +2,7 @@ module 0x42::M { struct CoolStruct has drop {} - // script functions with non-invocable signatures + // script functions no longer have any built in checks outside of visibility rules public(script) fun signer_ref(_: &signer) {} diff --git a/language/move-compiler/tests/move_check/typing/public_script_signature_warning.exp b/language/move-compiler/tests/move_check/typing/public_script_signature_warning.exp deleted file mode 100644 index 0d21a5fff8..0000000000 --- a/language/move-compiler/tests/move_check/typing/public_script_signature_warning.exp +++ /dev/null @@ -1,42 +0,0 @@ -warning[W04022]: script function cannot be invoked with this signature (NOTE: this may become an error in the future) - ┌─ tests/move_check/typing/public_script_signature_warning.move:7:24 - │ -7 │ public(script) fun signer_ref(_: &signer) {} - │ ^^^^^^^^^^ ------- Found: '&signer'. But expected one of: 'u8', 'u64', 'u128', 'bool', 'address', 'vector<_>' - │ │ - │ Invalid parameter for script function 'signer_ref' - -warning[W04022]: script function cannot be invoked with this signature (NOTE: this may become an error in the future) - ┌─ tests/move_check/typing/public_script_signature_warning.move:9:24 - │ -9 │ public(script) fun late_signer(_u: u64, _s: signer) {} - │ ^^^^^^^^^^^ ------ 'signer's must be a prefix of the arguments to a script--they must come before any non-signer types - │ │ - │ Invalid parameter for script function 'late_signer' - -warning[W04022]: script function cannot be invoked with this signature (NOTE: this may become an error in the future) - ┌─ tests/move_check/typing/public_script_signature_warning.move:11:24 - │ -11 │ public(script) fun struct_arg(_: CoolStruct) {} - │ ^^^^^^^^^^ ---------- Found: '0x42::M::CoolStruct'. But expected one of: 'u8', 'u64', 'u128', 'bool', 'address', 'vector<_>' - │ │ - │ Invalid parameter for script function 'struct_arg' - -warning[W04022]: script function cannot be invoked with this signature (NOTE: this may become an error in the future) - ┌─ tests/move_check/typing/public_script_signature_warning.move:13:24 - │ -13 │ public(script) fun u64_ret(): u64 { - │ ^^^^^^^ --- Given: 'u64' - │ │ - │ 'public(script)' functions must have a return type of '()' in order to be invocable as a script entry point - │ Expected: '()' - -warning[W04022]: script function cannot be invoked with this signature (NOTE: this may become an error in the future) - ┌─ tests/move_check/typing/public_script_signature_warning.move:17:24 - │ -17 │ public(script) fun struct_ret(): CoolStruct { - │ ^^^^^^^^^^ ---------- Given: '0x42::M::CoolStruct' - │ │ - │ 'public(script)' functions must have a return type of '()' in order to be invocable as a script entry point - │ Expected: '()' -