Skip to content

Commit

Permalink
Final response to Vineeth's review
Browse files Browse the repository at this point in the history
  • Loading branch information
brmataptos committed Sep 28, 2024
1 parent 2940f12 commit 0f3224a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Error: error[E04024]: invalid usage of function type
┌─ TEMPFILE:9:62
9 │ public fun for_each_ref<Element>(v: &vector<Element>, f: |&Element|) {
│ ^^^^^^^^^^ function type only allowed for inline function arguments
│ ^^^^^^^^^^ function-typed values only allowed for inline function arguments


Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ fn identify_function_types_with_functions_in_args(func_returns: Vec<Type>) -> Ve

// Takes a list of function-typed parameters, along with argument and result type
// Returns a list of any parameters whose result type has a function value, along with that result type.
fn identify_function_typed_params_with_functions_in_rets<'a>(
func_params: Vec<&'a Parameter>,
) -> Vec<(&'a Parameter, &'a Type)> {
fn identify_function_typed_params_with_functions_in_rets(
func_params: Vec<&Parameter>,
) -> Vec<(&Parameter, &Type)> {
func_params
.iter()
.filter_map(|param| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
error[E04007]: incompatible types
┌─ tests/move_check/typing/lambda_returning_lambda2.move:10:9
3 │ public inline fun foreach_caller2<T>(_v: &vector<T>, _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')

0 comments on commit 0f3224a

Please sign in to comment.