diff --git a/src/passes/6-transpiler/transpiler.ml b/src/passes/6-transpiler/transpiler.ml index 521d531fa..ce5f92989 100644 --- a/src/passes/6-transpiler/transpiler.ml +++ b/src/passes/6-transpiler/transpiler.ml @@ -518,7 +518,7 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re ok (prop_in_ty_map, acc @ path') ) in - let%bind (_, path) = bind_fold_right_list aux (ty, []) path in + let%bind (_, path) = bind_fold_list aux (ty, []) path in let%bind expr' = transpile_annotated_expression expr in return (E_assignment (typed_name.type_name, path, expr')) ) diff --git a/src/test/contracts/deep_access.ligo b/src/test/contracts/deep_access.ligo index 66f9a1d9b..7912aefc3 100644 --- a/src/test/contracts/deep_access.ligo +++ b/src/test/contracts/deep_access.ligo @@ -17,3 +17,15 @@ function main (const toto : unit) : int is block { a.0.x.0 := 2; const b:int = a.0.x.0; } with b + + +function asymetric_tuple_access(const foo : unit) : int is block { + var mytuple : int * (int * (int * int)) := (0,(1,(2,3))) ; +} with mytuple.0 + mytuple.1.0 + mytuple.1.1.0 + mytuple.1.1.1 + +type nested_record_t is record + nesty : (record mymap : map(int,string) ; end) ; +end +function nested_record (var nee : nested_record_t) : string is block { + nee.nesty.mymap[1] := "one" ; +} with ( get_force(1, nee.nesty.mymap) ) \ No newline at end of file diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 1a2a09ea2..9a4d2c8b6 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -1269,9 +1269,21 @@ let simple_access_ligo () : unit result = let deep_access_ligo () : unit result = let%bind program = type_file "./contracts/deep_access.ligo" in - let make_input = e_unit () in - let make_expected = e_int 2 in - expect_eq program "main" make_input make_expected + let%bind () = + let make_input = e_unit () in + let make_expected = e_int 2 in + expect_eq program "main" make_input make_expected in + let%bind () = + let make_input = e_unit () in + let make_expected = e_int 6 in + expect_eq program "asymetric_tuple_access" make_input make_expected in + let%bind () = + let make_input = e_ez_record [ ("nesty", + e_ez_record [ ("mymap", e_typed_map [] t_int t_string) ] ) ; ] in + let make_expected = e_string "one" in + expect_eq program "nested_record" make_input make_expected in + ok () + let entrypoints_ligo () : unit result = let%bind _program = type_file "./contracts/entrypoints.ligo" in