Introduce __ReturnsVoidToRx
[hiphop-php.git] / hphp / hack / src / typing / typing_set.ml
blob4e293ac37b9f7dea38f929cf59f69ec2e25d8692
1 (**
2 * Copyright (c) 2015, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
8 *)
10 (* An implementation of a set of types, using ty_compare for a total order.
11 * Typing-rule-equivalent types may get duplicated, as the equality induced
12 * by ty_compare does not expand Tvars and type aliases.
14 open Typing_defs
15 module Ty_ = struct
16 type t = locl ty
17 let compare r1 r2 = ty_compare r1 r2
18 end
20 include Set.Make(Ty_)
22 let pp fmt t =
23 Format.fprintf fmt "@[<hv 2>{";
24 ignore
25 (List.fold_left
26 (fun sep ty ->
27 if sep then Format.fprintf fmt ";@ ";
28 Pp_type.pp_ty fmt ty;
29 true)
30 false
31 (elements t));
32 Format.fprintf fmt "@,}@]"
34 let show = Format.asprintf "%a" pp