From 41d1f5e1b0efefe0d2c7bbce560f5f767b1a9061 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Wulfman Date: Mon, 25 May 2020 15:43:57 +0200 Subject: [PATCH] fix 2 missing loc in cameligo simplifier EProj et ETuple --- src/passes/2-concrete_to_imperative/cameligo.ml | 4 ++-- src/passes/8-typer-old/typer.ml | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/passes/2-concrete_to_imperative/cameligo.ml b/src/passes/2-concrete_to_imperative/cameligo.ml index 1e8c85f55..a9f80a5b2 100644 --- a/src/passes/2-concrete_to_imperative/cameligo.ml +++ b/src/passes/2-concrete_to_imperative/cameligo.ml @@ -338,7 +338,7 @@ let rec compile_expression : let (p , loc) = r_split p in let var = let name = Var.of_name p.struct_name.value in - e_variable name in + e_variable ~loc name in let path = p.field_path in let path' = let aux (s:Raw.selection) = @@ -532,7 +532,7 @@ let rec compile_expression : | EBytes x -> let (x , loc) = r_split x in return @@ e_literal ~loc (Literal_bytes (Hex.to_bytes @@ snd x)) - | ETuple tpl -> compile_tuple_expression @@ (npseq_to_list tpl.value) + | ETuple tpl -> compile_tuple_expression ~loc:(Location.lift tpl.region) @@ (npseq_to_list tpl.value) | ERecord r -> let (r , loc) = r_split r in let%bind fields = bind_list diff --git a/src/passes/8-typer-old/typer.ml b/src/passes/8-typer-old/typer.ml index 85079b11c..17af76c00 100644 --- a/src/passes/8-typer-old/typer.ml +++ b/src/passes/8-typer-old/typer.ml @@ -45,14 +45,13 @@ module Errors = struct ] in error ~data title message () - let unbound_variable (e:environment) (n:I.expression_variable) (loc:Location.t) () = + let unbound_variable (e:environment) (n:I.expression_variable) () = let name () = Format.asprintf "%a" I.PP.expression_variable n in let title = (thunk ("unbound variable "^(name ()))) in let message () = "" in let data = [ ("variable" , name) ; ("environment" , fun () -> Format.asprintf "%a" Environment.PP.environment e) ; - ("location" , fun () -> Format.asprintf "%a" Location.pp loc) ] in error ~data title message () @@ -698,7 +697,7 @@ and type_expression' : environment -> ?tv_opt:O.type_expression -> I.expression (* Basic *) | E_variable name -> let%bind tv' = - trace_option (unbound_variable e name ae.location) + trace_option (unbound_variable e name) @@ Environment.get_opt name e in return (E_variable name) tv'.type_value | E_literal Literal_unit ->