From 838fdf6a5f832047d8bcf54b34a1b660ef1df8c4 Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Mon, 8 Jun 2020 12:40:14 +0200 Subject: [PATCH] Fixed build. --- src/bin/expect_tests/literals.ml | 4 +- src/passes/01-parser/pascaligo/dune | 2 + .../02-concrete_to_imperative/pascaligo.ml | 48 +++++++++---------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/bin/expect_tests/literals.ml b/src/bin/expect_tests/literals.ml index c4c4b03a9..aebe463e3 100644 --- a/src/bin/expect_tests/literals.ml +++ b/src/bin/expect_tests/literals.ml @@ -7,7 +7,7 @@ let%expect_test _ = let%expect_test _ = run_ligo_bad ["interpret" ; "(\"thisisnotasignature\":signature)" ; "--syntax=pascaligo"] ; [%expect {| - ligo: in file "", line 0, characters 1-32. Badly formatted literal: Signature thisisnotasignature {"location":"in file \"\", line 0, characters 1-32"} + ligo: in file "", line 0, characters 0-33. Badly formatted literal: Signature thisisnotasignature {"location":"in file \"\", line 0, characters 0-33"} If you're not sure how to fix this error, you can @@ -25,7 +25,7 @@ let%expect_test _ = let%expect_test _ = run_ligo_bad ["interpret" ; "(\"thisisnotapublickey\":key)" ; "--syntax=pascaligo"] ; [%expect {| - ligo: in file "", line 0, characters 1-26. Badly formatted literal: key thisisnotapublickey {"location":"in file \"\", line 0, characters 1-26"} + ligo: in file "", line 0, characters 0-27. Badly formatted literal: key thisisnotapublickey {"location":"in file \"\", line 0, characters 0-27"} If you're not sure how to fix this error, you can diff --git a/src/passes/01-parser/pascaligo/dune b/src/passes/01-parser/pascaligo/dune index 5aa59af6d..5b2f099ca 100644 --- a/src/passes/01-parser/pascaligo/dune +++ b/src/passes/01-parser/pascaligo/dune @@ -17,6 +17,8 @@ (modules Scoping AST pascaligo Parser ParserLog LexToken ParErr Pretty) (libraries + pprint + terminal_size menhirLib parser_shared hex diff --git a/src/passes/02-concrete_to_imperative/pascaligo.ml b/src/passes/02-concrete_to_imperative/pascaligo.ml index 4d978247b..62a946fd6 100644 --- a/src/passes/02-concrete_to_imperative/pascaligo.ml +++ b/src/passes/02-concrete_to_imperative/pascaligo.ml @@ -282,20 +282,21 @@ let rec compile_expression (t:Raw.expr) : expr result = let return x = ok x in match t with | EAnnot a -> ( - let ((expr , type_expr) , loc) = r_split a in + let par, loc = r_split a in + let expr, _, type_expr = par.inside in let%bind expr' = compile_expression expr in let%bind type_expr' = compile_type_expression type_expr in return @@ e_annotation ~loc expr' type_expr' ) | EVar c -> ( - let (c' , loc) = r_split c in + let (c', loc) = r_split c in match constants c' with | None -> return @@ e_variable ~loc (Var.of_name c.value) | Some s -> return @@ e_constant ~loc s [] ) | ECall x -> ( - let ((f, args) , loc) = r_split x in - let (args , args_loc) = r_split args in + let ((f, args), loc) = r_split x in + let (args, args_loc) = r_split args in let args' = npseq_to_list args.inside in match f with | EVar name -> ( @@ -698,7 +699,7 @@ and compile_fun_expression : loc:_ -> Raw.fun_expr -> (type_expression option * expression) result = fun ~loc x -> let open! Raw in - let {kwd_recursive;param;ret_type;return} : fun_expr = x in + let {param; ret_type; return; _} : fun_expr = x in let statements = [] in (match param.value.inside with a, [] -> ( @@ -714,10 +715,8 @@ and compile_fun_expression : bind_fold_right_list aux result body in let binder = Var.of_name binder in let fun_type = t_function input_type output_type in - let expression = match kwd_recursive with - | None -> e_lambda ~loc binder (Some input_type)(Some output_type) result - | Some _ -> e_recursive ~loc binder fun_type - @@ {binder;input_type=Some input_type; output_type= Some output_type; result} + let expression = + e_lambda ~loc binder (Some input_type)(Some output_type) result in ok (Some fun_type , expression) ) @@ -745,10 +744,8 @@ and compile_fun_expression : let aux prec cur = cur (Some prec) in bind_fold_right_list aux result body in let fun_type = t_function input_type output_type in - let expression = match kwd_recursive with - | None -> e_lambda ~loc binder (Some input_type)(Some output_type) result - | Some _ -> e_recursive ~loc binder fun_type - @@ {binder;input_type=Some input_type; output_type= Some output_type; result} + let expression = + e_lambda ~loc binder (Some input_type)(Some output_type) result in ok (Some fun_type , expression) ) @@ -822,7 +819,7 @@ and compile_single_instruction : Raw.instruction -> (_ -> expression result) res let%bind bound = compile_expression fi.bound in let%bind step = match fi.step with | None -> ok @@ e_int_z Z.one - | Some step -> compile_expression step in + | Some (_, step) -> compile_expression step in let%bind body = compile_block fi.block.value in let%bind body = body @@ None in return_statement @@ e_for ~loc binder start bound step body @@ -910,23 +907,24 @@ and compile_single_instruction : Raw.instruction -> (_ -> expression result) res let%bind m = compile_cases cases in return_statement @@ e_matching ~loc expr m ) - | RecordPatch r -> ( + | RecordPatch r -> let reg = r.region in let (r,loc) = r_split r in - let aux (fa :Raw.field_assign Raw.reg) : Raw.field_path_assign Raw.reg= - {value = {field_path = (fa.value.field_name, []); equal=fa.value.equal; field_expr = fa.value.field_expr}; - region = fa.region} - in + let aux (fa :Raw.field_assign Raw.reg) : Raw.field_path_assign Raw.reg = + {value = {field_path = fa.value.field_name, []; + assignment = fa.value.assignment; + field_expr = fa.value.field_expr}; + region = fa.region} in let update : Raw.field_path_assign Raw.reg Raw.ne_injection Raw.reg = { - value = Raw.map_ne_injection aux r.record_inj.value; - region=r.record_inj.region - } in - let u : Raw.update = {record=r.path;kwd_with=r.kwd_with; updates=update} in + value = Raw.map_ne_injection aux r.record_inj.value; + region = r.record_inj.region} in + let u : Raw.update = { + record = r.path; + kwd_with = r.kwd_with; + updates = update} in let%bind expr = compile_update {value=u;region=reg} in let (name , access_path) = compile_path r.path in return_statement @@ e_ez_assign ~loc name access_path expr - - ) | MapPatch patch -> ( let (map_p, loc) = r_split patch in let (name, access_path) = compile_path map_p.path in