[sledge] Improve Set.union to preserve ==

Reviewed By: mbouaziz

Differential Revision: D14481989

fbshipit-source-id: 95c85be77
master
Josh Berdine 6 years ago committed by Facebook Github Bot
parent 0a97615da2
commit 681711c4d2

@ -265,6 +265,13 @@ module Set = struct
let inter_diff x y = (inter x y, diff y x) let inter_diff x y = (inter x y, diff y x)
let of_vector cmp x = of_array cmp (Vector.to_array x) let of_vector cmp x = of_array cmp (Vector.to_array x)
let to_tree = Using_comparator.to_tree let to_tree = Using_comparator.to_tree
let union x y =
let xy = union x y in
let xy_tree = to_tree xy in
if xy_tree == to_tree x then x
else if xy_tree == to_tree y then y
else xy
end end
module Qset = struct module Qset = struct

Loading…
Cancel
Save