From 8978c5c4d79bd86347a3cd56b65e436318445c39 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Fri, 20 Sep 2019 21:26:34 +0200 Subject: [PATCH] Print expresion in error message to ease further debugging --- src/main/run_typed.ml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/run_typed.ml b/src/main/run_typed.ml index aef51cd56..15478a9d9 100644 --- a/src/main/run_typed.ml +++ b/src/main/run_typed.ml @@ -86,7 +86,7 @@ let rec exp_to_value (exp: Mini_c.expression) : Mini_c.value result = end | E_make_empty_map _ -> ok @@ [] - | _ -> failwith "impossible" + | _ -> failwith "Ill-constructed map" in begin match exp.type_value with @@ -98,8 +98,9 @@ let rec exp_to_value (exp: Mini_c.expression) : Mini_c.value result = ok @@ D_map kvl | _ -> failwith "UPDATE with a non-map type_value" end - | _ -> - fail @@ simple_error "Can not convert expression to literal" + | _ as nl -> + let expp = Format.asprintf "'%a'" Mini_c.PP.expression' nl in + fail @@ simple_error ("Can not convert expression "^expp^" to literal") let convert_to_literals (e:Ast_typed.annotated_expression) : Mini_c.value result = let open Transpiler in