From 61459eb68ea7e414db8b05d91f90e755a3e8f5d6 Mon Sep 17 00:00:00 2001 From: "Brian R. Murphy" <132495859+brmataptos@users.noreply.github.com> Date: Fri, 27 Sep 2024 15:26:12 -0700 Subject: [PATCH] Final response to Vineeth's review --- .../tests/type_safety/gerbens_test.exp | 2 +- .../src/env_pipeline/recursive_struct_checker.rs | 13 ++++++------- .../file_format_generator/module_generator.rs | 2 -- .../typing/lambda_returning_lambda2.exp | 16 +++++----------- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/third_party/move/move-bytecode-verifier/transactional-tests/tests/type_safety/gerbens_test.exp b/third_party/move/move-bytecode-verifier/transactional-tests/tests/type_safety/gerbens_test.exp index 21191ffa107a6d..739b14b80441db 100644 --- a/third_party/move/move-bytecode-verifier/transactional-tests/tests/type_safety/gerbens_test.exp +++ b/third_party/move/move-bytecode-verifier/transactional-tests/tests/type_safety/gerbens_test.exp @@ -5,6 +5,6 @@ Error: error[E04024]: invalid usage of function type ┌─ TEMPFILE:9:62 │ 9 │ public fun for_each_ref(v: &vector, f: |&Element|) { - │ ^^^^^^^^^^ function type only allowed for inline function arguments + │ ^^^^^^^^^^ function-typed values only allowed for inline function arguments diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/recursive_struct_checker.rs b/third_party/move/move-compiler-v2/src/env_pipeline/recursive_struct_checker.rs index 1246ac0ea5ba0f..987a182f663d5e 100644 --- a/third_party/move/move-compiler-v2/src/env_pipeline/recursive_struct_checker.rs +++ b/third_party/move/move-compiler-v2/src/env_pipeline/recursive_struct_checker.rs @@ -117,12 +117,11 @@ impl<'a> RecursiveStructChecker<'a> { struct_name, struct_name, ); - self.mod_env - .env - .error_with_labels(&struct_env.get_loc(), "cyclic data", vec![( - field_env.get_loc().clone(), - note, - )]); + self.mod_env.env.error_with_labels( + &struct_env.get_loc(), + "cyclic data", + vec![(field_env.get_loc().clone(), note)], + ); } /// Report cyclic dependency of structs @@ -195,7 +194,7 @@ impl<'a> RecursiveStructChecker<'a> { .iter() .any(|ty| self.ty_contains_struct(path, ty, loc.clone(), struct_id, checked)) }, - Type::Primitive(_) | Type::TypeParameter(_) => false, + Type::Primitive(_) | Type::TypeParameter(_) | Type::Fun(..) => false, _ => panic!("ICE: {:?} used as a type parameter", ty), } } diff --git a/third_party/move/move-compiler-v2/src/file_format_generator/module_generator.rs b/third_party/move/move-compiler-v2/src/file_format_generator/module_generator.rs index b371d7f17cf2e4..483020e61a99eb 100644 --- a/third_party/move/move-compiler-v2/src/file_format_generator/module_generator.rs +++ b/third_party/move/move-compiler-v2/src/file_format_generator/module_generator.rs @@ -366,8 +366,6 @@ impl ModuleGenerator { } }, Fun(_param_ty, _result_ty) => { - // let _param_ty = Box::new(self.signature_token(ctx, loc, param_ty)); - // let _result_ty = Box::new(self.signature_token(ctx, loc, result_ty)); // TODO(LAMBDA) ctx.error( loc, diff --git a/third_party/move/move-compiler/tests/move_check/typing/lambda_returning_lambda2.exp b/third_party/move/move-compiler/tests/move_check/typing/lambda_returning_lambda2.exp index 3c0588535c6aaf..a14e1a5ff0d5c2 100644 --- a/third_party/move/move-compiler/tests/move_check/typing/lambda_returning_lambda2.exp +++ b/third_party/move/move-compiler/tests/move_check/typing/lambda_returning_lambda2.exp @@ -1,12 +1,6 @@ -error[E04007]: incompatible types - ┌─ tests/move_check/typing/lambda_returning_lambda2.move:10:9 - │ - 3 │ public inline fun foreach_caller2(_v: &vector, _action: ||(u64)) { - │ ----- Expected: 'u64' - · -10 │ foreach_caller2(&v, ||(|e| sum = sum + *e)) // expected to be not implemented - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - │ │ │ - │ │ Given: '|&{integer}|()' - │ Invalid call of '0x8675309::M::foreach_caller2'. Invalid argument for parameter '_action' +warning[W09003]: unused assignment + ┌─ tests/move_check/typing/lambda_returning_lambda2.move:9:13 + │ +9 │ let sum = 0; + │ ^^^ Unused assignment or binding for local 'sum'. Consider removing, replacing with '_', or prefixing with '_' (e.g., '_sum')