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 let enforce_no_body m
=
14 match m
.m_body
.fb_ast
with
16 | _
-> Errors.abstract_body
(fst m
.m_name
)
18 let check_interface c
=
19 List.iter c
.c_uses
(fun (p
, _
) -> Errors.interface_use_trait p
);
21 let (statics
, vars
) = split_vars c
in
25 let pos = fst hd
.cv_id
in
26 Errors.interface_with_member_variable
pos
33 let pos = fst hd
.cv_id
in
34 Errors.interface_with_static_member_variable
pos
38 (* make sure interfaces do not contain partially abstract type constants *)
39 List.iter c
.c_typeconsts
(fun tc
->
41 Option.is_some tc
.c_tconst_constraint
&& Option.is_some tc
.c_tconst_type
43 Errors.interface_with_partial_typeconst
(fst tc
.c_tconst_name
));
45 (* make sure that interfaces only have empty public methods *)
46 List.iter ~f
:enforce_no_body c
.c_methods
50 inherit Nast_visitor.handler_base
52 method! at_class_ _ c
=
53 if Ast_defs.(equal_class_kind c
.c_kind Cinterface
) then check_interface c