Proto: fix interpretation of tez constants.

This commit is contained in:
Benjamin Canou 2016-09-09 18:05:23 +02:00
parent e262a334dc
commit c9efaa2a64

View File

@ -542,14 +542,14 @@ and parse_untagged_data
| Int_t k, (Float (loc, _) | Prim (loc, _, _) | String (loc, _) | Seq (loc, _)) -> | Int_t k, (Float (loc, _) | Prim (loc, _, _) | String (loc, _) | Seq (loc, _)) ->
fail @@ Invalid_constant (loc, string_of_int_kind k) fail @@ Invalid_constant (loc, string_of_int_kind k)
(* Tez amounts *) (* Tez amounts *)
| Tez_t, Int (loc, v) -> begin try | Tez_t, String (loc, v) -> begin try
match Tez.of_string v with match Tez.of_string v with
| None -> raise Exit | None -> raise Exit
| Some tez -> return tez | Some tez -> return tez
with _ -> with _ ->
fail @@ Invalid_constant (loc, "tez") fail @@ Invalid_constant (loc, "tez")
end end
| Tez_t, (Float (loc, _) | Prim (loc, _, _) | String (loc, _) | Seq (loc, _)) -> | Tez_t, (Float (loc, _) | Int (loc, _) | Prim (loc, _, _) | Seq (loc, _)) ->
fail @@ Invalid_constant (loc, "tez") fail @@ Invalid_constant (loc, "tez")
(* Timestamps *) (* Timestamps *)
| Timestamp_t, (Float (loc, v) | Int (loc, v)) -> begin | Timestamp_t, (Float (loc, v) | Int (loc, v)) -> begin