From fdf7704a7c24f4ea472fd1d20c60e94c6dbe44f3 Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Tue, 14 May 2019 16:04:03 +0200 Subject: [PATCH] Fixed the type for ECall. --- src/parser/ligodity/AST.ml | 4 ++-- src/parser/ligodity/AST.mli | 2 +- src/parser/ligodity/Parser.mly | 4 ++-- src/parser/parser.ml | 1 + src/simplify/ligodity.ml | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/parser/ligodity/AST.ml b/src/parser/ligodity/AST.ml index 97ab55161..16cecd48e 100644 --- a/src/parser/ligodity/AST.ml +++ b/src/parser/ligodity/AST.ml @@ -203,7 +203,7 @@ and expr = | ERecord of record_expr | EProj of projection reg | EVar of variable -| ECall of (expr * expr list) reg +| ECall of (expr * expr Utils.nseq) reg | EBytes of (string * Hex.t) reg | EUnit of the_unit reg | ETuple of (expr, comma) Utils.nsepseq reg @@ -680,7 +680,7 @@ and print_expr undo = function | EString e -> print_string_expr undo e | ECall {value=f,l; _} -> - print_expr undo f; List.iter (print_expr undo) l + print_expr undo f; Utils.nseq_iter (print_expr undo) l | EVar v -> print_var v | EProj p -> print_projection p | EUnit {value=lpar,rpar; _} -> diff --git a/src/parser/ligodity/AST.mli b/src/parser/ligodity/AST.mli index 9f21f64fa..518e8c31c 100644 --- a/src/parser/ligodity/AST.mli +++ b/src/parser/ligodity/AST.mli @@ -213,7 +213,7 @@ and expr = | ERecord of record_expr (* {f1=e1; ... } *) | EProj of projection reg (* x.y.z M.x.y *) | EVar of variable (* x *) -| ECall of (expr * expr list) reg (* e e1 ... en *) +| ECall of (expr * expr Utils.nseq) reg (* e e1 ... en *) | EBytes of (string * Hex.t) reg (* 0xAEFF *) | EUnit of the_unit reg (* () *) | ETuple of (expr, comma) Utils.nsepseq reg (* e1, e2, ... *) diff --git a/src/parser/ligodity/Parser.mly b/src/parser/ligodity/Parser.mly index fbc323581..63f9ce957 100644 --- a/src/parser/ligodity/Parser.mly +++ b/src/parser/ligodity/Parser.mly @@ -375,7 +375,7 @@ match_expr(right_expr): let open Region in let cases = Utils.nsepseq_rev $5.value in let cast = EVar {region=ghost; value="assert_pos"} in - let cast = ECall {region=ghost; value=cast,[$2]} in + let cast = ECall {region=ghost; value=cast,($2,[])} in {kwd_match = $1; expr = cast; opening = With $3; lead_vbar = $4; cases = {$5 with value=cases}; closing = End Region.ghost} } @@ -509,7 +509,7 @@ constr_expr: constr core_expr? { $1,$2 } call_expr: - core_expr core_expr+ { $1,$2 } + core_expr nseq(core_expr) { $1,$2 } core_expr: reg(Int) { EArith (Int $1) } diff --git a/src/parser/parser.ml b/src/parser/parser.ml index 0ca86bd76..1a259af0f 100644 --- a/src/parser/parser.ml +++ b/src/parser/parser.ml @@ -2,6 +2,7 @@ open Trace module Pascaligo = Parser_pascaligo module Camligo = Parser_camligo +module Ligodity = Parser_ligodity open Parser_pascaligo module AST_Raw = Parser_pascaligo.AST diff --git a/src/simplify/ligodity.ml b/src/simplify/ligodity.ml index 67bb96d33..876ce0a97 100644 --- a/src/simplify/ligodity.ml +++ b/src/simplify/ligodity.ml @@ -129,7 +129,7 @@ let rec simpl_expression : let (f, args) = x.value in let%bind f' = simpl_expression f in let%bind args' = bind_map_list simpl_expression args in - match List.assoc_opt f constants with + match List.assoc_opt f' constants with | None -> let%bind arg = simpl_tuple_expression args' in return @@ E_application (make_e_a @@ E_variable f, arg)