[pulse] make sure we do not lose attributes when merging

Summary:
Losing attributes is a bug, not sure when it would matter. There's a
TODO there that's still valid.

Reviewed By: da319

Differential Revision: D28125940

fbshipit-source-id: 923ceedb8
master
Jules Villard 4 years ago committed by Facebook GitHub Bot
parent d94fa76eea
commit 13858e8d09

@ -174,7 +174,15 @@ let canonicalize ~get_var_repr attrs_map =
if Attributes.is_empty attrs then g if Attributes.is_empty attrs then g
else else
let addr' = get_var_repr addr in let addr' = get_var_repr addr in
add addr' attrs g ) let attrs' =
Graph.find_opt addr' g
|> Option.fold ~init:attrs ~f:(fun attrs attrs' ->
(* "merge" attributes if two different values ([addr] and [addr']) are found to be
equal after attributes of the same kind were recorded for them. This arbitrarily
keeps one of them, with unclear but likely benign consequences. *)
Attributes.union_prefer_left attrs' attrs )
in
add addr' attrs' g )
attrs_map Graph.empty attrs_map Graph.empty

Loading…
Cancel
Save