summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSon Ho2022-02-08 19:47:09 +0100
committerSon Ho2022-02-08 19:47:09 +0100
commit2968b4db7fba2d0cdde955eedad7292d3330a9a4 (patch)
tree4750722e2d75febf0b9212acab90a1645ea65ea1
parentf74da98b9972cf08104e6700302f333af65ba9b0 (diff)
Update some code in Print for Option
-rw-r--r--src/Print.ml10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Print.ml b/src/Print.ml
index 7c1ef79a..db0b325a 100644
--- a/src/Print.ml
+++ b/src/Print.ml
@@ -274,6 +274,16 @@ module Values = struct
(* Assumed type *)
match (aty, field_values) with
| Box, [ bv ] -> "@Box(" ^ bv ^ ")"
+ | Option, _ ->
+ if av.variant_id = Some T.option_some_id then
+ "@Option::Some("
+ ^ Collections.List.to_cons_nil field_values
+ ^ ")"
+ else if av.variant_id = Some T.option_none_id then (
+ assert (field_values = []);
+ "@Option::None")
+ else failwith "Unreachable"
+ | Vec, _ -> "@Vec[" ^ String.concat ", " field_values ^ "]"
| _ -> failwith "Inconsistent value")
| _ -> failwith "Inconsistent typed value")
| Bottom -> "⊥ : " ^ PT.ty_to_string ty_fmt v.ty