review 1
This commit is contained in:
parent
6a9547e910
commit
aac7dd3462
@ -7,7 +7,7 @@ dry_run_output=$(./scripts/ligo_ci.sh dry-run src/test/contracts/website2.ligo m
|
||||
|
||||
expected_compiled_parameter="(Right 1)";
|
||||
expected_compiled_storage=1;
|
||||
expected_dry_run_output="( list[] , 2 )";
|
||||
expected_dry_run_output="( LIST_EMPTY() , 2 )";
|
||||
|
||||
if [ "$compiled_storage" != "$expected_compiled_storage" ]; then
|
||||
echo "Expected $expected_compiled_storage as compile-storage output, got $compiled_storage instead";
|
||||
|
@ -13,7 +13,7 @@ let%expect_test _ =
|
||||
[%expect {| 1294 bytes |}] ;
|
||||
|
||||
run_ligo_good [ "measure-contract" ; contract "multisig-v2.ligo" ; "main" ] ;
|
||||
[%expect {| 3268 bytes |}] ;
|
||||
[%expect {| 2974 bytes |}] ;
|
||||
|
||||
run_ligo_good [ "measure-contract" ; contract "vote.mligo" ; "main" ] ;
|
||||
[%expect {| 589 bytes |}] ;
|
||||
@ -627,12 +627,7 @@ let%expect_test _ =
|
||||
IF { PUSH string "Maximum number of proposal reached" ; FAILWITH }
|
||||
{ PUSH unit Unit } ;
|
||||
NIL operation ;
|
||||
DIP 10 { DUP } ;
|
||||
DIG 10 ;
|
||||
DIP { DIP 4 { DUP } ; DIG 4 } ;
|
||||
PAIR ;
|
||||
DIP { DIP 9 { DUP } ; DIG 9 ; DIP { DUP } ; PAIR } ;
|
||||
PAIR ;
|
||||
DUP ;
|
||||
DIP { DIP 3 { DUP } ; DIG 3 } ;
|
||||
PAIR ;
|
||||
DIP 5 { DUP } ;
|
||||
@ -691,12 +686,8 @@ let%expect_test _ =
|
||||
DIP { DUP } ;
|
||||
SWAP ;
|
||||
DIP { DUP } ;
|
||||
PAIR ;
|
||||
DIP { DIP 2 { DUP } ; DIG 2 } ;
|
||||
PAIR ;
|
||||
DIP 2 { DUP } ;
|
||||
DIG 2 ;
|
||||
DIP { DIP 13 { DUP } ; DIG 13 } ;
|
||||
SWAP ;
|
||||
DIP { DIP 12 { DUP } ; DIG 12 } ;
|
||||
MEM ;
|
||||
IF { DIP 2 { DUP } ;
|
||||
DIG 2 ;
|
||||
@ -1126,7 +1117,7 @@ let%expect_test _ =
|
||||
let%expect_test _ =
|
||||
run_ligo_bad [ "compile-contract" ; bad_contract "create_contract_toplevel.mligo" ; "main" ] ;
|
||||
[%expect {|
|
||||
ligo: in file "create_contract_toplevel.mligo", line 4, character 35 to line 8, character 8. No free variable allowed in this lambda: variable 'store' {"expression":"CREATE_CONTRACT(lambda (#P:Some(( nat * string ))) : None return let rhs#654 = #P in let p = rhs#654.0 in let s = rhs#654.1 in ( LIST_EMPTY() : (TO_list(operation)) , store ) , NONE() : (TO_option(key_hash)) , 300000000mutez , \"un\")","location":"in file \"create_contract_toplevel.mligo\", line 4, character 35 to line 8, character 8"}
|
||||
ligo: in file "create_contract_toplevel.mligo", line 4, character 35 to line 8, character 8. No free variable allowed in this lambda: variable 'store' {"expression":"CREATE_CONTRACT(lambda (#P:Some(( nat * string ))) : None return let rhs#702 = #P in let p = rhs#702.0 in let s = rhs#702.1 in ( LIST_EMPTY() : (TO_list(operation)) , store ) , NONE() : (TO_option(key_hash)) , 300000000mutez , \"un\")","location":"in file \"create_contract_toplevel.mligo\", line 4, character 35 to line 8, character 8"}
|
||||
|
||||
|
||||
If you're not sure how to fix this error, you can
|
||||
@ -1139,7 +1130,7 @@ ligo: in file "create_contract_toplevel.mligo", line 4, character 35 to line 8,
|
||||
|
||||
run_ligo_bad [ "compile-contract" ; bad_contract "create_contract_var.mligo" ; "main" ] ;
|
||||
[%expect {|
|
||||
ligo: in file "create_contract_var.mligo", line 6, character 35 to line 10, character 5. No free variable allowed in this lambda: variable 'a' {"expression":"CREATE_CONTRACT(lambda (#P:Some(( nat * int ))) : None return let rhs#657 = #P in let p = rhs#657.0 in let s = rhs#657.1 in ( LIST_EMPTY() : (TO_list(operation)) , a ) , NONE() : (TO_option(key_hash)) , 300000000mutez , 1)","location":"in file \"create_contract_var.mligo\", line 6, character 35 to line 10, character 5"}
|
||||
ligo: in file "create_contract_var.mligo", line 6, character 35 to line 10, character 5. No free variable allowed in this lambda: variable 'a' {"expression":"CREATE_CONTRACT(lambda (#P:Some(( nat * int ))) : None return let rhs#705 = #P in let p = rhs#705.0 in let s = rhs#705.1 in ( LIST_EMPTY() : (TO_list(operation)) , a ) , NONE() : (TO_option(key_hash)) , 300000000mutez , 1)","location":"in file \"create_contract_var.mligo\", line 6, character 35 to line 10, character 5"}
|
||||
|
||||
|
||||
If you're not sure how to fix this error, you can
|
||||
|
@ -142,7 +142,7 @@ let rec transpile_type (t:AST.type_expression) : type_value result =
|
||||
let%bind kv' = bind_map_pair transpile_type (key, value) in
|
||||
ok (T_big_map kv')
|
||||
| T_operator (TC_map_or_big_map (_,_)) ->
|
||||
fail @@ corner_case ~loc:"transpiler" "TC_map_or_big_map should be resolve before transpilation"
|
||||
fail @@ corner_case ~loc:"transpiler" "TC_map_or_big_map should have been resolved before transpilation"
|
||||
| T_operator (TC_list t) ->
|
||||
let%bind t' = transpile_type t in
|
||||
ok (T_list t')
|
||||
|
@ -185,7 +185,7 @@ let rec untranspile (v : value) (t : AST.type_expression) : AST.expression resul
|
||||
let%bind init = return @@ E_constant {cons_name=C_BIG_MAP_EMPTY;arguments=[]} in
|
||||
bind_fold_right_list aux init big_map'
|
||||
)
|
||||
| TC_map_or_big_map (_, _) -> fail @@ corner_case ~loc:"untranspiler" "should not be present in mini-c"
|
||||
| TC_map_or_big_map (_, _) -> fail @@ corner_case ~loc:"untranspiler" "TC_map_or_big_map t should not be present in mini-c"
|
||||
| TC_list ty -> (
|
||||
let%bind lst =
|
||||
trace_strong (wrong_mini_c_value "list" v) @@
|
||||
|
@ -588,11 +588,11 @@ and type_expression' : environment -> ?tv_opt:O.type_expression -> I.expression
|
||||
let%bind key' = type_expression' e key in
|
||||
let tv_key = get_type_expression key' in
|
||||
let tv = match tv_opt with
|
||||
Some (tv) -> tv
|
||||
Some tv -> tv
|
||||
| None -> match cst with
|
||||
C_SET_ADD -> t_set tv_key ()
|
||||
| C_CONS -> t_list tv_key ()
|
||||
| _ -> failwith "impossible"
|
||||
| _ -> failwith "Only C_SET_ADD and C_CONS are possible because those were the two cases matched above"
|
||||
in
|
||||
let%bind set' = type_expression' e ~tv_opt:tv set in
|
||||
let tv_set = get_type_expression set' in
|
||||
@ -605,7 +605,7 @@ and type_expression' : environment -> ?tv_opt:O.type_expression -> I.expression
|
||||
let tv_key = get_type_expression key' in
|
||||
let tv_val = get_type_expression val' in
|
||||
let tv = match tv_opt with
|
||||
Some (tv) -> tv
|
||||
Some tv -> tv
|
||||
| None -> t_map_or_big_map tv_key tv_val ()
|
||||
in
|
||||
let%bind map' = type_expression' e ~tv_opt:tv map in
|
||||
|
@ -21,6 +21,10 @@ let rec check_no_nested_bigmap is_in_bigmap e =
|
||||
let%bind _ = check_no_nested_bigmap false key in
|
||||
let%bind _ = check_no_nested_bigmap true value in
|
||||
ok ()
|
||||
| T_operator (TC_map_or_big_map (key, value)) ->
|
||||
let%bind _ = check_no_nested_bigmap false key in
|
||||
let%bind _ = check_no_nested_bigmap true value in
|
||||
ok ()
|
||||
| T_operator (TC_contract t)
|
||||
| T_operator (TC_option t)
|
||||
| T_operator (TC_list t)
|
||||
|
@ -251,10 +251,10 @@ let extract_record : expression -> (label * expression) list result = fun e ->
|
||||
let extract_map : expression -> (expression * expression) list result = fun e ->
|
||||
let rec aux e =
|
||||
match e.expression_content with
|
||||
E_constant {cons_name=C_UPDATE; arguments=[k;v;map]} ->
|
||||
E_constant {cons_name=C_UPDATE|C_MAP_ADD; arguments=[k;v;map]} ->
|
||||
let%bind map = aux map in
|
||||
ok @@ (k,v)::map
|
||||
| E_constant {cons_name=C_MAP_EMPTY; arguments=[]} -> ok @@ []
|
||||
| E_constant {cons_name=C_MAP_EMPTY|C_BIG_MAP_EMPTY; arguments=[]} -> ok @@ []
|
||||
| _ -> fail @@ bad_kind "map" e.location
|
||||
in
|
||||
aux e
|
||||
|
Loading…
Reference in New Issue
Block a user