diff --git a/src/bin/cli.ml b/src/bin/cli.ml index 9a59280de..31e9261ab 100644 --- a/src/bin/cli.ml +++ b/src/bin/cli.ml @@ -139,18 +139,17 @@ let run_function = (term , Term.info ~docs cmdname) let evaluate_value = - failwith "TODO" - (* let f source entry_point amount syntax display_format = - * toplevel ~display_format @@ - * let%bind output = - * Ligo.Run.Of_source.evaluate_entry ~amount source entry_point (Syntax_name syntax) in - * ok @@ Format.asprintf "%a\n" Ast_simplified.PP.expression output - * in - * let term = - * Term.(const f $ source 0 $ entry_point 1 $ amount $ syntax $ display_format) in - * let cmdname = "evaluate-value" in - * let docs = "Subcommand: evaluate a given definition." in - * (term , Term.info ~docs cmdname) *) + let f source entry_point amount syntax display_format = + toplevel ~display_format @@ + let%bind output = + Ligo.Run.Of_source.evaluate_entry ~amount source entry_point (Syntax_name syntax) in + ok @@ Format.asprintf "%a\n" Ast_simplified.PP.expression output + in + let term = + Term.(const f $ source 0 $ entry_point 1 $ amount $ syntax $ display_format) in + let cmdname = "evaluate-value" in + let docs = "Subcommand: evaluate a given definition." in + (term , Term.info ~docs cmdname) let compile_expression = let f expression syntax display_format = diff --git a/src/main/compile/of_simplified.ml b/src/main/compile/of_simplified.ml index 3e4a5e9d1..cf8bc00fd 100644 --- a/src/main/compile/of_simplified.ml +++ b/src/main/compile/of_simplified.ml @@ -3,25 +3,23 @@ open Trace open Tezos_utils let compile_contract_entry (program : program) entry_point = - let%bind (_ , _ , prog_typed) = Typer.type_program program in + let%bind prog_typed = Typer.type_program program in Of_typed.compile_contract_entry prog_typed entry_point let compile_function_entry (program : program) entry_point : _ result = - let%bind (_ , _ , prog_typed) = Typer.type_program program in + let%bind prog_typed = Typer.type_program program in Of_typed.compile_function_entry prog_typed entry_point let compile_expression_as_function_entry (program : program) entry_point : _ result = - let%bind (_,_,typed_program) = Typer.type_program program in + let%bind typed_program = Typer.type_program program in Of_typed.compile_expression_as_function_entry typed_program entry_point let compile_expression_as_value ?(env = Ast_typed.Environment.full_empty) ae : Michelson.t result = - let todo_state = failwith "todo" in - let%bind (typed , _) = Typer.type_expression env todo_state ae in + let%bind typed = Typer.type_expression env ae in Of_typed.compile_expression_as_value typed let compile_expression_as_function ?(env = Ast_typed.Environment.full_empty) ae : _ result = - let todo_state = failwith "todo" in - let%bind (typed , _) = Typer.type_expression env todo_state ae in + let%bind typed = Typer.type_expression env ae in Of_typed.compile_expression_as_function typed let uncompile_typed_program_entry_expression_result program entry ex_ty_value = diff --git a/src/main/compile/of_source.ml b/src/main/compile/of_source.ml index bf1e4e6bc..f7576ec19 100644 --- a/src/main/compile/of_source.ml +++ b/src/main/compile/of_source.ml @@ -25,17 +25,15 @@ let compile_expression_as_function : string -> s_syntax -> _ result = let type_file ?(debug_simplify = false) ?(debug_typed = false) syntax (source_filename:string) : Ast_typed.program result = - let _ = debug_simplify, debug_typed, syntax, source_filename in - failwith "TODO" - (* let%bind syntax = syntax_to_variant syntax (Some source_filename) in - * let%bind simpl = parsify syntax source_filename in - * (if debug_simplify then - * Format.(printf "Simplified : %a\n%!" Ast_simplified.PP.program simpl) - * ) ; - * let%bind typed = - * trace (simple_error "typing") @@ - * Typer.type_program simpl in - * (if debug_typed then ( - * Format.(printf "Typed : %a\n%!" Ast_typed.PP.program typed) - * )) ; - * ok typed *) + let%bind syntax = syntax_to_variant syntax (Some source_filename) in + let%bind simpl = parsify syntax source_filename in + (if debug_simplify then + Format.(printf "Simplified : %a\n%!" Ast_simplified.PP.program simpl) + ) ; + let%bind typed = + trace (simple_error "typing") @@ + Typer.type_program simpl in + (if debug_typed then ( + Format.(printf "Typed : %a\n%!" Ast_typed.PP.program typed) + )) ; + ok typed diff --git a/src/passes/4-typer/typer.ml b/src/passes/4-typer/typer.ml index 330615bf9..f6a9078ff 100644 --- a/src/passes/4-typer/typer.ml +++ b/src/passes/4-typer/typer.ml @@ -873,9 +873,8 @@ and type_expression : environment -> Solver.state -> I.expression -> (O.annotate let%bind (result , state') = type_expression e' state result in let output_type = result.type_annotation in let wrapped = Wrap.lambda fresh input_type' output_type' in - let _TODO = output_type in return_wrapped - (E_lambda {binder = fst binder;(* input_type=fresh;output_type; *)body=result}) + (E_lambda {binder = fst binder; input_type=fresh;output_type; body=result}) state' wrapped )