diff --git a/compiler/heptagon/analysis/typing.ml b/compiler/heptagon/analysis/typing.ml index 2b67f70..ce4fb95 100644 --- a/compiler/heptagon/analysis/typing.ml +++ b/compiler/heptagon/analysis/typing.ml @@ -796,7 +796,7 @@ and typing_iterator const_env h in let mk_array_type ty_list = List.map (array_of_idx_list n_list) ty_list in let n_size = List.length n_list in - let mk_array_type_butnlast ty_list = + let mk_array_type_butnlast ty_list = map_butnlast n_size (array_of_idx_list n_list) ty_list in match it with | Imap -> @@ -811,10 +811,10 @@ and typing_iterator const_env h let args_ty_list = mk_array_type args_ty_list in let result_ty_list = mk_array_type result_ty_list in (* Last but one arg of the function should be integer *) - List.iter + List.iter (fun idx_ty -> - ( try unify cenv idx_ty (Tid Initial.pint) - with TypingError _ -> raise (TypingError (Emapi_bad_args idx_ty)))) + ( try unify cenv idx_ty (Tid Initial.pint) + with TypingError _ -> raise (TypingError (Emapi_bad_args idx_ty)))) idx_ty_list; let typed_e_list = typing_args const_env h args_ty_list e_list in @@ -836,8 +836,8 @@ and typing_iterator const_env h (* Last but one arg of the function should be integer *) List.iter (fun idx_ty -> - ( try unify cenv idx_ty (Tid Initial.pint) - with TypingError _ -> raise (TypingError (Emapi_bad_args idx_ty)))) + ( try unify cenv idx_ty (Tid Initial.pint) + with TypingError _ -> raise (TypingError (Emapi_bad_args idx_ty)))) idx_ty_list; let args_ty_list = mk_array_type_butnlast (args_ty_list@[acc_ty]) in let typed_e_list = diff --git a/compiler/main/mls2obc.ml b/compiler/main/mls2obc.ml index 9eded13..a56da08 100644 --- a/compiler/main/mls2obc.ml +++ b/compiler/main/mls2obc.ml @@ -91,7 +91,7 @@ let array_elt_of_exp idx e = mk_ext_value_exp ty (Warray(ext_value_of_exp e, idx)) | _ -> internal_error "mls2obc" -let rec array_elt_of_exp_list idx_list e = +let rec array_elt_of_exp_list idx_list e = match e.e_desc, Modules.unalias_type e.e_ty with | Econst ({ se_desc = Sarray_power (c, _) }), Tarray (ty,_) -> mk_exp ty (Econst c) @@ -440,7 +440,7 @@ let rec translate_eq map call_context { Minils.eq_lhs = pat; Minils.eq_rhs = e } let p_list = List.map (translate_extvalue_to_exp map) pe_list in let c_list = List.map (translate_extvalue_to_exp map) e_list in let xl, xdl = List.split (List.map (fun _ -> fresh_it ()) n_list) in - let call_context = + let call_context = Some { oa_index = List.map (fun x -> mk_pattern_int (Lvar x)) xl; oa_size = n_list} in let n_list = List.map mk_exp_static_int n_list in @@ -536,7 +536,7 @@ and translate_iterator map call_context it name_list List.map2 (fun l ty -> aux l ty xl) name_list ty_list in let array_of_input c_list = - List.map (array_elt_of_exp_list (List.map mk_evar_int xl)) c_list + List.map (array_elt_of_exp_list (List.map mk_evar_int xl)) c_list in let mk_loop b xdl nl = let rec mk_loop b xdl nl = match xdl, nl with @@ -544,7 +544,7 @@ and translate_iterator map call_context it name_list | xd::xdl, n::nl -> mk_loop (mk_block [Afor (xd, mk_exp_const_int 0, n, b)]) xdl nl | _, _ -> assert false in - mk_loop b (List.rev xdl) nl + mk_loop b (List.rev xdl) nl in match it with | Minils.Imap -> diff --git a/compiler/obc/c/cgen.ml b/compiler/obc/c/cgen.ml index be5bac5..6094dc6 100644 --- a/compiler/obc/c/cgen.ml +++ b/compiler/obc/c/cgen.ml @@ -406,7 +406,7 @@ let step_fun_call out_env var_env sig_info objn out args = | Oobj o -> Cfield (Cderef (Cvar "self"), local_qn (name o)) | Oarray (o, l) -> let f = Cfield (Cderef (Cvar "self"), local_qn (name o)) in - let rec mk_idx pl = match pl with + let rec mk_idx pl = match pl with | [] -> f | p::pl -> Carray (mk_idx pl, Clhs (clhs_of_lhs var_env p)) in @@ -568,7 +568,7 @@ let rec cstm_of_act out_env var_env obj_env act = let field = Cfield (Cderef (Cvar "self"), local_qn (name on)) in let rec mk_loop nl elt = match nl with | [] -> [Csexpr (Cfun_call (classn ^ "_reset", [Caddrof elt] ))] - | n::nl -> + | n::nl -> let x = gen_symbol () in let elt = Carray(elt, Clhs (Cvar x)) in [Cfor(x, Cconst (Ccint 0), cexpr_of_static_exp n, mk_loop nl elt)] @@ -667,7 +667,7 @@ let mem_decl_of_class_def cd = let ty = Cty_id (qn_append od.o_class "_mem") in let ty = match od.o_size with | Some nl -> - let rec mk_idx nl = match nl with + let rec mk_idx nl = match nl with | [] -> ty | n::nl -> Cty_arr (int_of_static_exp n, mk_idx nl) in diff --git a/compiler/utilities/misc.ml b/compiler/utilities/misc.ml index b85d386..8b5c977 100644 --- a/compiler/utilities/misc.ml +++ b/compiler/utilities/misc.ml @@ -52,9 +52,9 @@ let rec map_butlast f l = let map_butnlast n f l = let rec aux l = match l with | [] -> [], 0 - | a::l -> + | a::l -> let (res, k) = aux l in - if k < n then + if k < n then a::res, (k + 1) else (f a)::res, (k+1) @@ -82,9 +82,9 @@ let rec split_last = function let rec split_nlast n l = let rec aux l = match l with | [] -> [], [], 0 - | a::l -> + | a::l -> let (l1, l2, k) = aux l in - if k < n then + if k < n then l1, a::l2, (k + 1) else a::l1, l2, (k+1)