Print expresion in error message to ease further debugging

This commit is contained in:
Lesenechal Remi 2019-09-20 21:26:34 +02:00
parent ea6f51bd55
commit 8978c5c4d7

View File

@ -86,7 +86,7 @@ let rec exp_to_value (exp: Mini_c.expression) : Mini_c.value result =
end end
| E_make_empty_map _ -> | E_make_empty_map _ ->
ok @@ [] ok @@ []
| _ -> failwith "impossible" | _ -> failwith "Ill-constructed map"
in in
begin begin
match exp.type_value with 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 ok @@ D_map kvl
| _ -> failwith "UPDATE with a non-map type_value" | _ -> failwith "UPDATE with a non-map type_value"
end end
| _ -> | _ as nl ->
fail @@ simple_error "Can not convert expression to literal" 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 convert_to_literals (e:Ast_typed.annotated_expression) : Mini_c.value result =
let open Transpiler in let open Transpiler in