From 5c3e1ad642790f9e5ef9bb7a7d7a0e5d3b817d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suzanne=20Dup=C3=A9ron?= Date: Thu, 31 Oct 2019 17:19:01 -0400 Subject: [PATCH] Hack for E_constant with loops shouldn't be necessary in new typer, thanks to typeclasses? --- src/passes/4-typer/typer.ml | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/src/passes/4-typer/typer.ml b/src/passes/4-typer/typer.ml index ab2ecd61d..6a82ba9a6 100644 --- a/src/passes/4-typer/typer.ml +++ b/src/passes/4-typer/typer.ml @@ -707,42 +707,6 @@ and type_expression : environment -> Solver.state -> I.expression -> (O.annotate * let%bind (name', tv) = * type_constant name tv_lst tv_opt ae.location in * return (E_constant (name' , lst')) tv *) - | E_constant ( ("LIST_FOLD"|"MAP_FOLD"|"SET_FOLD") as opname , - [ collect ; - init_record ; - ( { expression = (I.E_lambda { binder = (lname, None) ; - input_type = None ; - output_type = None ; - result }) ; - location = _ }) as _lambda - ] ) -> -let _TODO = (opname, collect, init_record, lname, result) in -failwith "TODO: E_constant merge" -(* ******************************************************************************************************************************************************** *) -(* - (* this special case is here force annotation of the untyped lambda - generated by pascaligo's for_collect loop *) - let%bind (v_col , v_initr ) = bind_map_pair (type_expression e) (collect , init_record ) in - let tv_col = get_type_annotation v_col in (* this is the type of the collection *) - let tv_out = get_type_annotation v_initr in (* this is the output type of the lambda*) - let%bind input_type = match tv_col.type_value' with - | O.T_constant ( ("list"|"set") , t) -> ok @@ t_tuple (tv_out::t) () - | O.T_constant ( "map" , t) -> ok @@ t_tuple (tv_out::[(t_tuple t ())]) () - | _ -> - let wtype = Format.asprintf - "Loops over collections expect lists, sets or maps, got type %a" O.PP.type_value tv_col in - fail @@ simple_error wtype in - let e' = Environment.add_ez_binder lname input_type e in - let%bind body = type_expression ?tv_opt:(Some tv_out) e' result in - let output_type = body.type_annotation in - let lambda' = make_a_e (E_lambda {binder = lname ; body}) (t_function input_type output_type ()) e in - let lst' = [v_col; v_initr ; lambda'] in - let tv_lst = List.map get_type_annotation lst' in - let%bind (opname', tv) = - type_constant opname tv_lst tv_opt ae.location in - return (E_constant (opname' , lst')) tv -*) -(* ******************************************************************************************************************************************************** *) | E_application (f, arg) -> let%bind (f' , state') = type_expression e state f in let%bind (arg , state'') = type_expression e state' arg in