Patch typing.ml from brice email 27/06/11.

This commit is contained in:
Léonard Gérard 2011-07-07 16:19:30 +02:00
parent 42c2936040
commit f40dc66e57

View file

@ -796,8 +796,8 @@ and typing_iterator cenv h
in in
let mk_array_type ty_list = List.map (array_of_idx_list n_list) ty_list 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 n_size = List.length n_list in
let mk_array_type_butnlast ty_list = let mk_array_type_butlast ty_list =
map_butnlast n_size (array_of_idx_list n_list) ty_list in map_butlast (array_of_idx_list n_list) ty_list in
match it with match it with
| Imap -> | Imap ->
let args_ty_list = mk_array_type args_ty_list in let args_ty_list = mk_array_type args_ty_list in
@ -821,7 +821,7 @@ and typing_iterator cenv h
prod result_ty_list, typed_e_list prod result_ty_list, typed_e_list
| Ifold -> | Ifold ->
let args_ty_list = mk_array_type_butnlast args_ty_list in let args_ty_list = mk_array_type_butlast args_ty_list in
let typed_e_list = let typed_e_list =
typing_args cenv h args_ty_list e_list in typing_args cenv h args_ty_list e_list in
(*check accumulator type matches in input and output*) (*check accumulator type matches in input and output*)
@ -839,7 +839,7 @@ and typing_iterator cenv h
( try unify cenv idx_ty (Tid Initial.pint) ( try unify cenv idx_ty (Tid Initial.pint)
with TypingError _ -> raise (TypingError (Emapi_bad_args idx_ty)))) with TypingError _ -> raise (TypingError (Emapi_bad_args idx_ty))))
idx_ty_list; idx_ty_list;
let args_ty_list = mk_array_type_butnlast (args_ty_list@[acc_ty]) in let args_ty_list = mk_array_type_butlast (args_ty_list@[acc_ty]) in
let typed_e_list = let typed_e_list =
typing_args cenv h args_ty_list e_list in typing_args cenv h args_ty_list e_list in
(*check accumulator type matches in input and output*) (*check accumulator type matches in input and output*)
@ -849,8 +849,8 @@ and typing_iterator cenv h
(List.hd result_ty_list), typed_e_list (List.hd result_ty_list), typed_e_list
| Imapfold -> | Imapfold ->
let args_ty_list = mk_array_type_butnlast args_ty_list in let args_ty_list = mk_array_type_butlast args_ty_list in
let result_ty_list = mk_array_type_butnlast result_ty_list in let result_ty_list = mk_array_type_butlast result_ty_list in
let typed_e_list = typing_args cenv h let typed_e_list = typing_args cenv h
args_ty_list e_list in args_ty_list e_list in
(*check accumulator type matches in input and output*) (*check accumulator type matches in input and output*)