From a3deccf352bcbb80ea32ef89ed6885c424b76919 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Sun, 27 Oct 2019 11:43:51 +0100 Subject: [PATCH] changing the name of the lambda to 'arguments' make its arguments available --- src/passes/2-simplify/pascaligo.ml | 2 +- src/passes/4-typer/typer.ml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/passes/2-simplify/pascaligo.ml b/src/passes/2-simplify/pascaligo.ml index f2ee15c73..066949450 100644 --- a/src/passes/2-simplify/pascaligo.ml +++ b/src/passes/2-simplify/pascaligo.ml @@ -1054,7 +1054,7 @@ and simpl_for_collect : Raw.for_collect -> (_ -> expression result) result = fun (* build the X_FOLD constant *) - let lambda = e_lambda "_COMPILER_for_collect_lambda" None None block' in + let lambda = e_lambda "arguments" None None block' in let%bind collect = simpl_expression fc.expr in let op_name = match fc.collection with | Map _ -> "MAP_FOLD" diff --git a/src/passes/4-typer/typer.ml b/src/passes/4-typer/typer.ml index 7b3744d79..73a8144e2 100644 --- a/src/passes/4-typer/typer.ml +++ b/src/passes/4-typer/typer.ml @@ -618,7 +618,7 @@ and type_expression : environment -> ?tv_opt:O.type_value -> I.expression -> O.a | E_constant ( ("LIST_FOLD"|"MAP_FOLD"|"SET_FOLD") as opname , [ collect ; init_record ; - ( { expression = (I.E_lambda { binder = (name, None) ; + ( { expression = (I.E_lambda { binder = (lname, None) ; input_type = None ; output_type = None ; result }) ; @@ -636,10 +636,10 @@ and type_expression : environment -> ?tv_opt:O.type_value -> I.expression -> O.a let input_type = t_tuple (tv_out::[collect_inner_type]) () in let output_type = Some tv_out in - let e' = Environment.add_ez_binder "arguments" input_type e in + let e' = Environment.add_ez_binder lname input_type e in let%bind body = type_expression ?tv_opt:output_type e' result in let output_type = body.type_annotation in - let%bind lambda' = ok @@ make_a_e (E_lambda {binder = name ; body}) (t_function input_type output_type ()) e in + let%bind lambda' = ok @@ make_a_e (E_lambda {binder = lname ; body}) (t_function input_type output_type ()) e in let%bind lst' = ok @@ lst'@[lambda'] in let tv_lst = List.map get_type_annotation lst' in