diff --git a/src/passes/2-simplify/ligodity.ml b/src/passes/2-simplify/ligodity.ml index 39c60639c..d524901ad 100644 --- a/src/passes/2-simplify/ligodity.ml +++ b/src/passes/2-simplify/ligodity.ml @@ -593,14 +593,15 @@ and simpl_declaration : Raw.declaration -> declaration Location.wrap list result if i = (List.length variables) then accesses else let accesses = - build_access_expr :: accesses + build_access_expr :: accesses in gen_access_tuple name ~i: (i + 1) ~accesses in ok (gen_access_tuple name) (* TODO: Improve this error message *) | other -> fail @@ simplifying_expr other in let%bind decls = - bind_map_list process_variable (List.combine variables expr_bind_lst) + (* TODO: Rewrite the gen_access_tuple so there's no List.rev *) + bind_map_list process_variable (List.combine variables (List.rev expr_bind_lst)) in ok @@ decls | PPar {region = _ ; value = { lpar = _ ; inside = pt; rpar = _; } } -> (* Extract parenthetical multi-bind *) diff --git a/src/test/contracts/let_multiple.mligo b/src/test/contracts/let_multiple.mligo index 588bce0ab..c399f2952 100644 --- a/src/test/contracts/let_multiple.mligo +++ b/src/test/contracts/let_multiple.mligo @@ -11,4 +11,4 @@ let main_paren (p: unit) : int = x + y let foobar : (int * int) = (23 , 42) let (foo : int) , (bar : int) = foobar -let non_tuple_rhs (p: unit) : int = foo + bar +let non_tuple_rhs (p: unit) : int = bar - foo diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index eb8b36535..afa219205 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -1215,7 +1215,7 @@ let mligo_let_multiple () : unit result = in let%bind () = let input = e_unit () in - let expected = e_int 65 in + let expected = e_int 19 in expect_eq program "non_tuple_rhs" input expected in ok ()