@@ -20,12 +20,12 @@ let reset_lazy () =
2020
2121
2222type t = string option [@@ deriving eq , ord , hash ]
23+ (* * [None] means top. *)
2324
2425let hash x =
25- if get_string_domain () = Disjoint then
26- hash x
27- else
28- 13859
26+ match get_string_domain () with
27+ | Disjoint | Flat -> hash x
28+ | Unit -> 13859
2929
3030let show = function
3131 | Some x -> " \" " ^ x ^ " \" "
@@ -39,10 +39,9 @@ include Printable.SimpleShow (
3939 )
4040
4141let of_string x =
42- if get_string_domain () = Unit then
43- None
44- else
45- Some x
42+ match get_string_domain () with
43+ | Unit -> None
44+ | Disjoint | Flat -> Some x
4645let to_string x = x
4746
4847(* only keep part before first null byte *)
@@ -91,24 +90,25 @@ let join x y =
9190 | _ , None -> None
9291 | Some a , Some b when a = b -> Some a
9392 | Some a , Some b (* when a <> b *) ->
94- if get_string_domain () = Disjoint then
95- raise Lattice. Uncomparable
96- else
97- None
93+ match get_string_domain () with
94+ | Disjoint -> raise Lattice. Uncomparable
95+ | Flat -> None
96+ | Unit -> assert false
9897
9998let meet x y =
10099 match x, y with
101100 | None , a
102101 | a , None -> a
103102 | Some a , Some b when a = b -> Some a
104103 | Some a , Some b (* when a <> b *) ->
105- if get_string_domain () = Disjoint then
106- raise Lattice. Uncomparable
107- else
108- raise Lattice. BotValue
104+ match get_string_domain () with
105+ | Disjoint -> raise Lattice. Uncomparable
106+ | Flat -> raise Lattice. BotValue
107+ | Unit -> assert false
109108
110109let repr x =
111- if get_string_domain () = Disjoint then
110+ match get_string_domain () with
111+ | Disjoint ->
112112 x (* everything else is kept separate, including strings if not limited *)
113- else
113+ | Flat | Unit ->
114114 None (* all strings together if limited *)
0 commit comments