2 * Copyright (c) 2018, Facebook, Inc.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
16 let check_xhp_children env pos ty
=
17 let _, ty
= Env.expand_type env ty
in
18 let _, ty
= Env.fold_unresolved env ty
in
19 let tys = match ty
with
20 | _, Tunresolved ts
-> ts
22 if not
@@ List.for_all ~f
:(Env.is_xhp_child env pos
) tys
24 let ty_str = Env.print_error_ty env ty
in
25 let msgl = Reason.to_string
("This is "^
ty_str) (fst ty
) in
26 Errors.illegal_xhp_child pos
msgl
29 inherit Tast_visitor.handler_base
31 method! at_expr env
= function
32 | _, Xml
(_, _, tel
) ->
33 List.iter tel ~f
:(fun ((pos
, ty
), _) -> check_xhp_children env pos ty
)