Skip to content

Commit 6671ad9

Browse files
committed
HashCachedContextLifter: Fixes
* correct comment on the function of relift * Rename M->Base for consistency * Fix relift
1 parent a980df2 commit 6671ad9

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/common/domains/printable.ml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ sig
2626
(* For hashconsing together with incremental we need to re-hashcons old values.
2727
* For HashconsLifter.D this is done on any lattice operation, so we can replace x with `join bot x` to hashcons it again and get a new tag for it.
2828
* For HashconsLifter.C we call hashcons only in `context` which is in Analyses.Spec but not in Analyses.GlobConstrSys, i.e. not visible to the solver. *)
29-
(* The default for this should be identity, except for HConsed below where we want to have the side-effect and return a value with the updated tag. *)
29+
(* The default for functors should pass the call to their argument modules, except for HConsed below where we want to have the side-effect and return a value with the updated tag. *)
3030
val relift: t -> t
3131
end
3232

@@ -162,40 +162,40 @@ struct
162162
let arbitrary () = QCheck.map ~rev:unlift lift (Base.arbitrary ())
163163
end
164164

165-
module HashCached (M: S) =
165+
module HashCached (Base: S) =
166166
struct
167-
module LazyHash = LazyEval.Make (struct type t = M.t type result = int let eval = M.hash end)
167+
module LazyHash = LazyEval.Make (struct type t = Base.t type result = int let eval = Base.hash end)
168168

169-
let name () = "HashCached " ^ M.name ()
169+
let name () = "HashCached " ^ Base.name ()
170170

171171
type t =
172172
{
173-
m: M.t;
173+
m: Base.t;
174174
lazy_hash: LazyHash.t;
175175
}
176176

177177
let lift m = {m; lazy_hash = LazyHash.make m}
178178
let unlift {m; _} = m
179-
let relift x = x
179+
let relift x = lift @@ Base.relift x.m
180180

181181
let lift_f f x = f (unlift x)
182182
let lift_f' f x = lift @@ lift_f f x
183183
let lift_f2 f x y = f (unlift x) (unlift y)
184184
let lift_f2' f x y = lift @@ lift_f2 f x y
185185

186-
let equal = lift_f2 M.equal
187-
let compare = lift_f2 M.compare
186+
let equal = lift_f2 Base.equal
187+
let compare = lift_f2 Base.compare
188188
let hash x = LazyHash.force x.lazy_hash
189-
let show = lift_f M.show
189+
let show = lift_f Base.show
190190

191-
let pretty () = lift_f (M.pretty ())
191+
let pretty () = lift_f (Base.pretty ())
192192

193-
let printXml f = lift_f (M.printXml f)
194-
let to_yojson = lift_f (M.to_yojson)
193+
let printXml f = lift_f (Base.printXml f)
194+
let to_yojson = lift_f (Base.to_yojson)
195195

196-
let arbitrary () = QCheck.map ~rev:unlift lift (M.arbitrary ())
196+
let arbitrary () = QCheck.map ~rev:unlift lift (Base.arbitrary ())
197197

198-
let tag = lift_f M.tag
198+
let tag = lift_f Base.tag
199199
end
200200

201201

0 commit comments

Comments
 (0)