Enforce Pos_or_decl.t in reasons for decl types
[hiphop-php.git] / hphp / hack / src / typing / typing_const_reifiable.ml
blob50ec6354dadeb7e498de2618b935e5f936635188
1 (*
2 * Copyright (c) 2019, 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 open Hh_prelude
11 open Typing_defs
13 let check_reifiable env tc attr_pos =
14 let check_impl kind ty_opt =
15 match ty_opt with
16 | Some ty ->
17 let emit_err = Errors.reifiable_attr attr_pos kind in
18 Typing_reified_check.validator#validate_type
19 env
20 (fst tc.ttc_name)
22 ~reification:Type_validator.Unresolved
23 emit_err
24 | None -> ()
26 check_impl "type" tc.ttc_type;
27 check_impl "constraint" tc.ttc_as_constraint;
28 match tc.ttc_abstract with
29 | TCAbstract default_ty -> check_impl "type" default_ty
30 | _ -> ()