Fixed build.

This commit is contained in:
Christian Rinderknecht 2020-06-08 12:40:14 +02:00
parent 2d65ba638e
commit 838fdf6a5f
3 changed files with 27 additions and 27 deletions

View File

@ -7,7 +7,7 @@ let%expect_test _ =
let%expect_test _ = let%expect_test _ =
run_ligo_bad ["interpret" ; "(\"thisisnotasignature\":signature)" ; "--syntax=pascaligo"] ; run_ligo_bad ["interpret" ; "(\"thisisnotasignature\":signature)" ; "--syntax=pascaligo"] ;
[%expect {| [%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 If you're not sure how to fix this error, you can
@ -25,7 +25,7 @@ let%expect_test _ =
let%expect_test _ = let%expect_test _ =
run_ligo_bad ["interpret" ; "(\"thisisnotapublickey\":key)" ; "--syntax=pascaligo"] ; run_ligo_bad ["interpret" ; "(\"thisisnotapublickey\":key)" ; "--syntax=pascaligo"] ;
[%expect {| [%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 If you're not sure how to fix this error, you can

View File

@ -17,6 +17,8 @@
(modules (modules
Scoping AST pascaligo Parser ParserLog LexToken ParErr Pretty) Scoping AST pascaligo Parser ParserLog LexToken ParErr Pretty)
(libraries (libraries
pprint
terminal_size
menhirLib menhirLib
parser_shared parser_shared
hex hex

View File

@ -282,20 +282,21 @@ let rec compile_expression (t:Raw.expr) : expr result =
let return x = ok x in let return x = ok x in
match t with match t with
| EAnnot a -> ( | 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 expr' = compile_expression expr in
let%bind type_expr' = compile_type_expression type_expr in let%bind type_expr' = compile_type_expression type_expr in
return @@ e_annotation ~loc expr' type_expr' return @@ e_annotation ~loc expr' type_expr'
) )
| EVar c -> ( | EVar c -> (
let (c' , loc) = r_split c in let (c', loc) = r_split c in
match constants c' with match constants c' with
| None -> return @@ e_variable ~loc (Var.of_name c.value) | None -> return @@ e_variable ~loc (Var.of_name c.value)
| Some s -> return @@ e_constant ~loc s [] | Some s -> return @@ e_constant ~loc s []
) )
| ECall x -> ( | ECall x -> (
let ((f, args) , loc) = r_split x in let ((f, args), loc) = r_split x in
let (args , args_loc) = r_split args in let (args, args_loc) = r_split args in
let args' = npseq_to_list args.inside in let args' = npseq_to_list args.inside in
match f with match f with
| EVar name -> ( | EVar name -> (
@ -698,7 +699,7 @@ and compile_fun_expression :
loc:_ -> Raw.fun_expr -> (type_expression option * expression) result = loc:_ -> Raw.fun_expr -> (type_expression option * expression) result =
fun ~loc x -> fun ~loc x ->
let open! Raw in 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 let statements = [] in
(match param.value.inside with (match param.value.inside with
a, [] -> ( a, [] -> (
@ -714,10 +715,8 @@ and compile_fun_expression :
bind_fold_right_list aux result body in bind_fold_right_list aux result body in
let binder = Var.of_name binder in let binder = Var.of_name binder in
let fun_type = t_function input_type output_type in let fun_type = t_function input_type output_type in
let expression = match kwd_recursive with let expression =
| None -> e_lambda ~loc binder (Some input_type)(Some output_type) result 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}
in in
ok (Some fun_type , expression) ok (Some fun_type , expression)
) )
@ -745,10 +744,8 @@ and compile_fun_expression :
let aux prec cur = cur (Some prec) in let aux prec cur = cur (Some prec) in
bind_fold_right_list aux result body in bind_fold_right_list aux result body in
let fun_type = t_function input_type output_type in let fun_type = t_function input_type output_type in
let expression = match kwd_recursive with let expression =
| None -> e_lambda ~loc binder (Some input_type)(Some output_type) result 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}
in in
ok (Some fun_type , expression) 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 bound = compile_expression fi.bound in
let%bind step = match fi.step with let%bind step = match fi.step with
| None -> ok @@ e_int_z Z.one | 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 = compile_block fi.block.value in
let%bind body = body @@ None in let%bind body = body @@ None in
return_statement @@ e_for ~loc binder start bound step body 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 let%bind m = compile_cases cases in
return_statement @@ e_matching ~loc expr m return_statement @@ e_matching ~loc expr m
) )
| RecordPatch r -> ( | RecordPatch r ->
let reg = r.region in let reg = r.region in
let (r,loc) = r_split r in let (r,loc) = r_split r in
let aux (fa :Raw.field_assign Raw.reg) : Raw.field_path_assign Raw.reg= 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}; {value = {field_path = fa.value.field_name, [];
region = fa.region} assignment = fa.value.assignment;
in field_expr = fa.value.field_expr};
region = fa.region} in
let update : Raw.field_path_assign Raw.reg Raw.ne_injection Raw.reg = { let update : Raw.field_path_assign Raw.reg Raw.ne_injection Raw.reg = {
value = Raw.map_ne_injection aux r.record_inj.value; value = Raw.map_ne_injection aux r.record_inj.value;
region=r.record_inj.region region = r.record_inj.region} in
} in let u : Raw.update = {
let u : Raw.update = {record=r.path;kwd_with=r.kwd_with; updates=update} in record = r.path;
kwd_with = r.kwd_with;
updates = update} in
let%bind expr = compile_update {value=u;region=reg} in let%bind expr = compile_update {value=u;region=reg} in
let (name , access_path) = compile_path r.path in let (name , access_path) = compile_path r.path in
return_statement @@ e_ez_assign ~loc name access_path expr return_statement @@ e_ez_assign ~loc name access_path expr
)
| MapPatch patch -> ( | MapPatch patch -> (
let (map_p, loc) = r_split patch in let (map_p, loc) = r_split patch in
let (name, access_path) = compile_path map_p.path in let (name, access_path) = compile_path map_p.path in