diff --git a/src/passes/2-simplify/cameligo.ml b/src/passes/2-simplify/cameligo.ml index 222dee09f..910da246f 100644 --- a/src/passes/2-simplify/cameligo.ml +++ b/src/passes/2-simplify/cameligo.ml @@ -812,8 +812,8 @@ and simpl_declaration : Raw.declaration -> declaration Location.wrap list result ok (var , tl) in let%bind lhs_type' = bind_map_option (fun x -> simpl_type_expression (snd x)) lhs_type in - let let_rhs = match args with - | [] -> let_rhs + let%bind let_rhs,lhs_type = match args with + | [] -> ok (let_rhs, lhs_type') | param1::others -> let fun_ = { kwd_fun = Region.ghost; @@ -822,18 +822,13 @@ and simpl_declaration : Raw.declaration -> declaration Location.wrap list result arrow = Region.ghost; body = let_rhs } in - Raw.EFun {region=Region.ghost ; value=fun_} - in - let f_args = (match let_rhs with - | Raw.EFun f -> nseq_to_list f.value.binders - | _ -> [] - ) + let f_args = nseq_to_list (param1,others) in + let%bind ty = bind_map_list typed_pattern_to_typed_vars f_args in + let aux acc ty = Option.map (t_function (snd ty)) acc in + ok (Raw.EFun {region=Region.ghost ; value=fun_},List.fold_right' aux lhs_type' ty) in let%bind rhs' = simpl_expression let_rhs in - let%bind ty = bind_map_list typed_pattern_to_typed_vars f_args in - let aux acc ty = Option.map (t_function (snd ty)) acc in - let func_type = List.fold_right' aux lhs_type' ty in - ok @@ [loc x @@ (Declaration_constant (Var.of_name var.value , func_type , inline, rhs'))] + ok @@ [loc x @@ (Declaration_constant (Var.of_name var.value , lhs_type , inline, rhs'))] ) and simpl_cases : type a . (Raw.pattern * a) list -> (a, unit) matching_content result = diff --git a/test.mligo b/test.mligo new file mode 100644 index 000000000..5ad65e3f3 --- /dev/null +++ b/test.mligo @@ -0,0 +1,3 @@ +let f : int = fun (x, y : int*int) -> x + y +let g (x, y : int * int) : int = f (x, y) +