fix and more tests
This commit is contained in:
parent
c322ca53de
commit
c1c551e33f
@ -518,7 +518,7 @@ and transpile_annotated_expression (ae:AST.annotated_expression) : expression re
|
|||||||
ok (prop_in_ty_map, acc @ path')
|
ok (prop_in_ty_map, acc @ path')
|
||||||
)
|
)
|
||||||
in
|
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
|
let%bind expr' = transpile_annotated_expression expr in
|
||||||
return (E_assignment (typed_name.type_name, path, expr'))
|
return (E_assignment (typed_name.type_name, path, expr'))
|
||||||
)
|
)
|
||||||
|
@ -17,3 +17,15 @@ function main (const toto : unit) : int is block {
|
|||||||
a.0.x.0 := 2;
|
a.0.x.0 := 2;
|
||||||
const b:int = a.0.x.0;
|
const b:int = a.0.x.0;
|
||||||
} with b
|
} 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) )
|
@ -1269,9 +1269,21 @@ let simple_access_ligo () : unit result =
|
|||||||
|
|
||||||
let deep_access_ligo () : unit result =
|
let deep_access_ligo () : unit result =
|
||||||
let%bind program = type_file "./contracts/deep_access.ligo" in
|
let%bind program = type_file "./contracts/deep_access.ligo" in
|
||||||
|
let%bind () =
|
||||||
let make_input = e_unit () in
|
let make_input = e_unit () in
|
||||||
let make_expected = e_int 2 in
|
let make_expected = e_int 2 in
|
||||||
expect_eq program "main" make_input make_expected
|
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 entrypoints_ligo () : unit result =
|
||||||
let%bind _program = type_file "./contracts/entrypoints.ligo" in
|
let%bind _program = type_file "./contracts/entrypoints.ligo" in
|
||||||
|
Loading…
Reference in New Issue
Block a user