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.
13 type ctx
= { class_tparams
: Nast.tparam list
}
17 inherit [ctx
] Nast_visitor.iter_with_state
as super
19 method! on_hint
(env
, state
) (pos
, h
) =
22 | Habstr
(tp_name
, args
) ->
25 ~f
:(fun { tp_name
= (c_tp_pos
, c_tp_name
); _
} ->
26 if String.equal c_tp_name tp_name
then
27 Errors.typeconst_depends_on_external_tparam
31 List.iter args ~f
:(this#on_hint
(env
, state
))
34 super#on_hint
(env
, state
) (pos
, h
)
39 inherit Nast_visitor.handler_base
41 method! at_class_ env c
=
42 let state = { class_tparams
= c
.c_tparams
} in
43 let on_hint = visitor#
on_hint (env
, state) in
44 List.iter c
.c_typeconsts ~f
:(fun t
->
45 match t
.c_tconst_kind
with
48 c_atc_as_constraint
= a
;
49 c_atc_super_constraint
= s
;
52 Option.iter a ~f
:on_hint;
53 Option.iter s ~f
:on_hint;
54 Option.iter d ~f
:on_hint
55 | TCConcrete
{ c_tc_type
= t
} -> on_hint t
)