Skip to content

Commit 2102bad

Browse files
fahndrichfacebook-github-bot
authored andcommitted
Fix missing Product Context handling
Summary: Noticed that Context was not handled by Product domain Reviewed By: dkgi Differential Revision: D30464626 fbshipit-source-id: 0424a46bd6907b53d0a2ffec6ebc7682f4f6566a
1 parent 917699f commit 2102bad

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

source/domains/abstractProductDomain.ml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,9 @@ module Make (Config : PRODUCT_CONFIG) = struct
294294

295295
let transform : type a f. a part -> ([ `Transform ], a, f, _) operation -> f:f -> t -> t =
296296
fun part op ~f product ->
297-
match part with
298-
| Self -> Base.transform part op ~f product
297+
match part, op with
298+
| Self, _ -> Base.transform part op ~f product
299+
| _, Context (Self, _) -> Base.transform part op ~f product
299300
| _ ->
300301
let transform (Slot slot) =
301302
let value = get slot product in
@@ -311,8 +312,9 @@ module Make (Config : PRODUCT_CONFIG) = struct
311312
: type a f b. a part -> using:([ `Reduce ], a, f, b) operation -> f:f -> init:b -> t -> b
312313
=
313314
fun part ~using:op ~f ~init product ->
314-
match part with
315-
| Self -> Base.reduce part ~using:op ~f ~init product
315+
match part, op with
316+
| Self, _ -> Base.reduce part ~using:op ~f ~init product
317+
| _, Context (Self, _) -> Base.reduce part ~using:op ~f ~init product
316318
| _ ->
317319
let fold (Slot slot) =
318320
let value = get slot product in
@@ -328,8 +330,9 @@ module Make (Config : PRODUCT_CONFIG) = struct
328330
a part -> ([ `Partition ], a, f, b) operation -> f:f -> t -> (b, t) Core_kernel.Map.Poly.t
329331
=
330332
fun part op ~f product ->
331-
match part with
332-
| Self -> Base.partition part op ~f product
333+
match part, op with
334+
| Self, _ -> Base.partition part op ~f product
335+
| _, Context (Self, _) -> Base.partition part op ~f product
333336
| _ ->
334337
let partition (Slot slot) : (b, t) Core_kernel.Map.Poly.t =
335338
let value = get slot product in

0 commit comments

Comments
 (0)