[sledge] Fix order of Exp.fold args

Reviewed By: ngorogiannis

Differential Revision: D14251654

fbshipit-source-id: 8d1e22da7
master
Josh Berdine 6 years ago committed by Facebook Github Bot
parent 55540d3500
commit 8fa2f86b7e

@ -1039,17 +1039,13 @@ let iter e ~f =
let fold e ~init:s ~f =
match e with
| App {op; arg} ->
let s = f s op in
let s = f s arg in
s
| App {op; arg} -> f op (f arg s)
| Add {args} | Mul {args} ->
let s = Qset.fold ~f:(fun e _ s -> f s e) args ~init:s in
s
Qset.fold ~f:(fun e _ s -> f e s) args ~init:s
| _ -> s
let for_all e ~f = fold ~f:(fun so_far a -> so_far && f a) ~init:true e
let exists e ~f = fold ~f:(fun found a -> found || f a) ~init:false e
let for_all e ~f = fold ~f:(fun a so_far -> so_far && f a) ~init:true e
let exists e ~f = fold ~f:(fun a found -> found || f a) ~init:false e
let app1 ?(partial = false) op arg =
( match (op, arg) with

@ -204,7 +204,7 @@ val offset : t -> (Q.t * Typ.t) option
val iter : t -> f:(t -> unit) -> unit
val fold_vars : t -> init:'a -> f:('a -> Var.t -> 'a) -> 'a
val fold_exps : t -> init:'a -> f:('a -> t -> 'a) -> 'a
val fold : t -> init:'a -> f:('a -> t -> 'a) -> 'a
val fold : t -> init:'a -> f:(t -> 'a -> 'a) -> 'a
val for_all : t -> f:(t -> bool) -> bool
val exists : t -> f:(t -> bool) -> bool

@ -551,7 +551,7 @@ let rec norm_extend r ek =
~default:e
~if_added:(fun lkp ->
let use =
Exp.fold e_' ~init:r.use ~f:(fun use b'j ->
Exp.fold e_' ~init:r.use ~f:(fun b'j use ->
let b' = Exp.base b'j in
Map.update use b' ~f:(function
| Some b_use -> Use.add b_use e

Loading…
Cancel
Save