diff options
author | Son Ho | 2022-02-08 19:47:09 +0100 |
---|---|---|
committer | Son Ho | 2022-02-08 19:47:09 +0100 |
commit | 2968b4db7fba2d0cdde955eedad7292d3330a9a4 (patch) | |
tree | 4750722e2d75febf0b9212acab90a1645ea65ea1 /src | |
parent | f74da98b9972cf08104e6700302f333af65ba9b0 (diff) |
Update some code in Print for Option
Diffstat (limited to 'src')
-rw-r--r-- | src/Print.ml | 10 |
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 |