From 2968b4db7fba2d0cdde955eedad7292d3330a9a4 Mon Sep 17 00:00:00 2001 From: Son Ho Date: Tue, 8 Feb 2022 19:47:09 +0100 Subject: Update some code in Print for Option --- src/Print.ml | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 -- cgit v1.2.3