mapping over type_operator types is useless

This commit is contained in:
Lesenechal Remi 2020-02-21 17:18:51 +01:00 committed by Pierre-Emmanuel Wulfman
parent 503d8f771e
commit 66aca916bf
2 changed files with 3 additions and 32 deletions

View File

@ -1174,7 +1174,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 : ( nat * string ):Some(( nat * string ))) : None return let rhs#808 = #P in let p = rhs#808.0 in let s = rhs#808.1 in ( list[] : (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 : ( nat * string ):Some(( nat * string ))) : None return let rhs#809 = #P in let p = rhs#809.0 in let s = rhs#809.1 in ( list[] : (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
@ -1187,7 +1187,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 : ( nat * int ):Some(( nat * int ))) : None return let rhs#811 = #P in let p = rhs#811.0 in let s = rhs#811.1 in ( list[] : (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 : ( nat * int ):Some(( nat * int ))) : None return let rhs#812 = #P in let p = rhs#812.0 in let s = rhs#812.1 in ( list[] : (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

View File

@ -186,38 +186,9 @@ and map_type_expression : ty_exp_mapper -> type_expression -> type_expression re
let%bind type1' = self type1 in
let%bind type2' = self type2 in
return @@ (T_arrow {type1=type1' ; type2=type2'})
| T_operator type_op ->
let%bind to' = map_type_operator f type_op in
return @@ (T_operator to')
| T_operator _
| T_variable _ | T_constant _ -> ok te'
and map_type_operator : ty_exp_mapper -> type_operator -> type_operator result = fun f te ->
match te with
| TC_contract e ->
let%bind e' = map_type_expression f e in
ok @@ TC_contract e'
| TC_option e ->
let%bind e' = map_type_expression f e in
ok @@ TC_option e'
| TC_list e ->
let%bind e' = map_type_expression f e in
ok @@ TC_list e'
| TC_set e ->
let%bind e' = map_type_expression f e in
ok @@ TC_set e'
| TC_map (a , b) ->
let%bind a' = map_type_expression f a in
let%bind b' = map_type_expression f b in
ok @@ TC_map (a' , b')
| TC_big_map (a , b) ->
let%bind a' = map_type_expression f a in
let%bind b' = map_type_expression f b in
ok @@ TC_big_map (a' , b')
| TC_arrow (a , b) ->
let%bind a' = map_type_expression f a in
let%bind b' = map_type_expression f b in
ok @@ TC_arrow (a' , b')
and map_cases : exp_mapper -> matching_expr -> matching_expr result = fun f m ->
match m with
| Match_bool { match_true ; match_false } -> (