Error when reified method + __DynamicallyCallable attribute
[hiphop-php.git] / hphp / hack / src / errors / errors.mli
blob1a7eb38614668b99ea506ab5aa77571710299ade
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 type 'a error_
12 type 'a message
14 val get_message_pos : 'a message -> 'a
16 val get_message_str : 'a message -> string
18 type error = Pos.t error_ [@@deriving eq]
20 type applied_fixme = Pos.t * int
22 module type Error_category = sig
23 type t
25 val min : int
27 val max : int
29 val of_enum : int -> t option
31 val show : t -> string
33 val err_code : t -> int
34 end
36 (* The analysis phase that the error is coming from. *)
37 type phase =
38 | Init
39 | Parsing
40 | Naming
41 | Decl
42 | Typing
43 [@@deriving eq]
45 type severity =
46 | Warning
47 | Error
49 type format =
50 | Context
51 | Raw
52 | Highlighted
54 type typing_error_callback = ?code:int -> (Pos.t * string) list -> unit
56 type name_context =
57 | FunctionNamespace
58 | ConstantNamespace
59 | TypeNamespace
60 | TraitContext
61 | ClassContext
62 | RecordContext
64 module Parsing : Error_category
66 module Naming : Error_category
68 module NastCheck : Error_category
70 module Typing : Error_category
72 val read_lines : string -> string list
74 val num_digits : int -> int
76 val add_error : error -> unit
78 (* Error codes that can be suppressed in strict mode with a FIXME based on configuration. *)
79 val allowed_fixme_codes_strict : ISet.t ref
81 val allowed_fixme_codes_partial : ISet.t ref
83 val codes_not_raised_partial : ISet.t ref
85 (* Error codes that should be treated strictly, regardless of their file mode. *)
86 val error_codes_treated_strictly : ISet.t ref
88 val report_pos_from_reason : bool ref
90 val is_strict_code : int -> bool
92 val set_allow_errors_in_default_path : bool -> unit
94 val is_hh_fixme : (Pos.t -> int -> bool) ref
96 val is_hh_fixme_disallowed : (Pos.t -> int -> bool) ref
98 val get_hh_fixme_pos : (Pos.t -> int -> Pos.t option) ref
100 val to_list : 'a error_ -> ('a * string) list
102 val get_code : 'a error_ -> int
104 val get_pos : error -> Pos.t
106 val get_severity : 'a error_ -> severity
108 val get_messages : 'a error_ -> 'a message list
110 val make_error : int -> (Pos.t * string) list -> error
112 val make_absolute_error :
113 int -> (Pos.absolute * string) list -> Pos.absolute error_
115 val error_code_to_string : int -> string
117 val phase_to_string : phase -> string
119 val phase_of_string : string -> phase option
121 val name_context_to_string : name_context -> string
123 val internal_error : Pos.t -> string -> unit
125 val unimplemented_feature : Pos.t -> string -> unit
127 val experimental_feature : Pos.t -> string -> unit
129 val fixme_format : Pos.t -> unit
131 val missing_field : Pos.t -> Pos.t -> string -> typing_error_callback -> unit
133 val violated_constraint :
134 Pos.t ->
135 Pos.t * string ->
136 (Pos.t * string) list ->
137 (Pos.t * string) list ->
138 typing_error_callback ->
139 unit
141 val method_variance : Pos.t -> unit
143 val explain_constraint :
144 use_pos:Pos.t ->
145 definition_pos:Pos.t ->
146 param_name:string ->
147 (Pos.t * string) list ->
148 unit
150 val explain_where_constraint :
151 in_class:bool ->
152 use_pos:Pos.t ->
153 definition_pos:Pos.t ->
154 (Pos.t * string) list ->
155 unit
157 val explain_tconst_where_constraint :
158 use_pos:Pos.t -> definition_pos:Pos.t -> (Pos.t * string) list -> unit
160 val abstract_tconst_not_allowed : Pos.t -> Pos.t * string -> unit
162 val unexpected_arrow : Pos.t -> string -> unit
164 val missing_arrow : Pos.t -> string -> unit
166 val disallowed_xhp_type : Pos.t -> string -> unit
168 val name_is_reserved : string -> Pos.t -> unit
170 val dollardollar_unused : Pos.t -> unit
172 val mutating_const_property : Pos.t -> unit
174 val self_const_parent_not : Pos.t -> unit
176 val overriding_prop_const_mismatch :
177 Pos.t -> bool -> Pos.t -> bool -> typing_error_callback -> unit
179 val method_name_already_bound : Pos.t -> string -> unit
181 val error_name_already_bound : string -> string -> Pos.t -> Pos.t -> unit
183 val error_class_attribute_already_bound :
184 string -> string -> Pos.t -> Pos.t -> unit
186 val unbound_name : Pos.t -> string -> name_context -> unit
188 val invalid_fun_pointer : Pos.t -> string -> unit
190 val undefined :
191 in_rx_scope:bool -> Pos.t -> string -> (string * Pos.t) option -> unit
193 val this_reserved : Pos.t -> unit
195 val start_with_T : Pos.t -> unit
197 val already_bound : Pos.t -> string -> unit
199 val unexpected_typedef : Pos.t -> Pos.t -> name_context -> unit
201 val fd_name_already_bound : Pos.t -> unit
203 val mk_fd_name_already_bound : Pos.t -> error
205 val repeated_record_field : string -> Pos.t -> Pos.t -> unit
207 val unexpected_record_field_name :
208 field_name:string ->
209 field_pos:Pos.t ->
210 record_name:string ->
211 decl_pos:Pos.t ->
212 unit
214 val missing_record_field_name :
215 field_name:string ->
216 new_pos:Pos.t ->
217 record_name:string ->
218 field_decl_pos:Pos.t ->
219 unit
221 val type_not_record : string -> Pos.t -> unit
223 val primitive_toplevel : Pos.t -> unit
225 val primitive_invalid_alias : Pos.t -> string -> string -> unit
227 val dynamic_new_in_strict_mode : Pos.t -> unit
229 val xhp_optional_required_attr : Pos.t -> string -> unit
231 val xhp_required_with_default : Pos.t -> string -> unit
233 val array_typehints_disallowed : Pos.t -> unit
235 val wildcard_hint_disallowed : Pos.t -> unit
237 val wildcard_param_disallowed : Pos.t -> unit
239 val object_cast : Pos.t -> unit
241 val this_no_argument : Pos.t -> unit
243 val this_hint_outside_class : Pos.t -> unit
245 val this_type_forbidden : Pos.t -> unit
247 val nonstatic_property_with_lsb : Pos.t -> unit
249 val lowercase_this : Pos.t -> string -> unit
251 val classname_param : Pos.t -> unit
253 val typaram_applied_to_type : Pos.t -> string -> unit
255 val tparam_with_tparam : Pos.t -> string -> unit
257 val shadowed_type_param : Pos.t -> Pos.t -> string -> unit
259 val missing_typehint : Pos.t -> unit
261 val expected_variable : Pos.t -> unit
263 val clone_too_many_arguments : Pos.t -> unit
265 val naming_too_few_arguments : Pos.t -> unit
267 val naming_too_many_arguments : Pos.t -> unit
269 val expected_collection : Pos.t -> string -> unit
271 val illegal_CLASS : Pos.t -> unit
273 val illegal_TRAIT : Pos.t -> unit
275 val nullsafe_property_write_context : Pos.t -> unit
277 val illegal_fun : Pos.t -> unit
279 val illegal_member_variable_class : Pos.t -> unit
281 val illegal_meth_fun : Pos.t -> unit
283 val illegal_inst_meth : Pos.t -> unit
285 val illegal_meth_caller : Pos.t -> unit
287 val illegal_class_meth : Pos.t -> unit
289 val class_meth_non_final_self : Pos.t -> string -> unit
291 val class_meth_non_final_CLASS : Pos.t -> bool -> string -> unit
293 val assert_arity : Pos.t -> unit
295 val unexpected_ty_in_tast :
296 Pos.t -> actual_ty:string -> expected_ty:string -> unit
298 val uninstantiable_class :
299 Pos.t -> Pos.t -> string -> (Pos.t * string) list -> unit
301 val new_abstract_record : Pos.t * string -> unit
303 val abstract_const_usage : Pos.t -> Pos.t -> string -> unit
305 val concrete_const_interface_override :
306 Pos.t -> Pos.t -> string -> string -> typing_error_callback -> unit
308 val const_without_typehint : Pos.t * string -> unit
310 val prop_without_typehint : string -> Pos.t * string -> unit
312 val illegal_constant : Pos.t -> unit
314 val parsing_error : Pos.t * string -> unit
316 val xhp_parsing_error : Pos.t * string -> unit
318 val format_string :
319 Pos.t -> string -> string -> Pos.t -> string -> string -> unit
321 val expected_literal_format_string : Pos.t -> unit
323 val re_prefixed_non_string : Pos.t -> string -> unit
325 val bad_regex_pattern : Pos.t -> string -> unit
327 val generic_array_strict : Pos.t -> unit
329 val option_return_only_typehint : Pos.t -> [< `void | `noreturn ] -> unit
331 val tuple_syntax : Pos.t -> unit
333 val redeclaring_missing_method : Pos.t -> string -> unit
335 val expecting_type_hint : Pos.t -> unit
337 val expecting_type_hint_variadic : Pos.t -> unit
339 val expecting_return_type_hint : Pos.t -> unit
341 val expecting_awaitable_return_type_hint : Pos.t -> unit
343 val field_kinds : Pos.t -> Pos.t -> unit
345 val unbound_name_typing : Pos.t -> string -> unit
347 val unbound_name_type_constant_access :
348 access_pos:Pos.t -> name_pos:Pos.t -> string -> unit
350 val did_you_mean_naming : Pos.t -> string -> Pos.t -> string -> unit
352 val previous_default : Pos.t -> unit
354 val return_only_typehint : Pos.t -> [< `void | `noreturn ] -> unit
356 val unexpected_type_arguments : Pos.t -> unit
358 val too_many_type_arguments : Pos.t -> unit
360 val return_in_void : Pos.t -> Pos.t -> unit
362 val this_var_outside_class : Pos.t -> unit
364 val unbound_global : Pos.t -> unit
366 val private_inst_meth : def_pos:Pos.t -> use_pos:Pos.t -> unit
368 val protected_inst_meth : def_pos:Pos.t -> use_pos:Pos.t -> unit
370 val private_class_meth : def_pos:Pos.t -> use_pos:Pos.t -> unit
372 val protected_class_meth : def_pos:Pos.t -> use_pos:Pos.t -> unit
374 val array_cast : Pos.t -> unit
376 val string_cast : Pos.t -> string -> unit
378 val static_outside_class : Pos.t -> unit
380 val self_outside_class : Pos.t -> unit
382 val new_inconsistent_construct :
383 Pos.t -> Pos.t * string -> [< `static | `classname ] -> unit
385 val undefined_parent : Pos.t -> unit
387 val parent_outside_class : Pos.t -> unit
389 val parent_abstract_call : string -> Pos.t -> Pos.t -> unit
391 val self_abstract_call : string -> Pos.t -> Pos.t -> unit
393 val classname_abstract_call : string -> string -> Pos.t -> Pos.t -> unit
395 val static_synthetic_method : string -> string -> Pos.t -> Pos.t -> unit
397 val isset_in_strict : Pos.t -> unit
399 val unset_nonidx_in_strict : Pos.t -> (Pos.t * string) list -> unit
401 val unpacking_disallowed_builtin_function : Pos.t -> string -> unit
403 val invalid_destructure :
404 Pos.t -> Pos.t -> string -> typing_error_callback -> unit
406 val unpack_array_required_argument :
407 Pos.t -> Pos.t -> typing_error_callback -> unit
409 val unpack_array_variadic_argument :
410 Pos.t -> Pos.t -> typing_error_callback -> unit
412 val array_get_arity : Pos.t -> string -> Pos.t -> unit
414 val typing_error : Pos.t -> string -> unit
416 val undefined_field :
417 use_pos:Pos.t -> name:string -> shape_type_pos:Pos.t -> unit
419 val array_access_read : Pos.t -> Pos.t -> string -> unit
421 val array_access_write : Pos.t -> Pos.t -> string -> unit
423 val keyset_set : Pos.t -> Pos.t -> unit
425 val array_append : Pos.t -> Pos.t -> string -> unit
427 val const_mutation : Pos.t -> Pos.t -> string -> unit
429 val expected_class : ?suffix:string -> Pos.t -> unit
431 val unknown_type : string -> Pos.t -> (Pos.t * string) list -> unit
433 val smember_not_found :
434 [< `class_constant | `class_variable | `static_method | `class_typeconst ] ->
435 Pos.t ->
436 Pos.t * string ->
437 string ->
438 [< `closest of Pos.t * string | `did_you_mean of Pos.t * string | `no_hint ] ->
439 typing_error_callback ->
440 unit
442 val member_not_found :
443 [< `property | `method_ ] ->
444 Pos.t ->
445 Pos.t * string ->
446 string ->
447 [< `closest of Pos.t * string | `did_you_mean of Pos.t * string | `no_hint ] ->
448 (Pos.t * string) list ->
449 typing_error_callback ->
450 unit
452 val parent_in_trait : Pos.t -> unit
454 val parent_undefined : Pos.t -> unit
456 val constructor_no_args : Pos.t -> unit
458 val visibility : Pos.t -> string -> Pos.t -> string -> unit
460 val typing_too_many_args :
461 int -> int -> Pos.t -> Pos.t -> typing_error_callback option -> unit
463 val typing_too_few_args :
464 int -> int -> Pos.t -> Pos.t -> typing_error_callback option -> unit
466 val bad_call : Pos.t -> string -> unit
468 val extend_final : Pos.t -> Pos.t -> string -> unit
470 val extend_non_abstract_record : string -> Pos.t -> Pos.t -> unit
472 val extend_sealed : Pos.t -> Pos.t -> string -> string -> string -> unit
474 val trait_prop_const_class : Pos.t -> string -> unit
476 val read_before_write : Pos.t * string -> unit
478 val implement_abstract :
479 is_final:bool -> Pos.t -> Pos.t -> string -> string -> unit
481 val generic_static : Pos.t -> string -> unit
483 val fun_too_many_args : Pos.t -> Pos.t -> typing_error_callback -> unit
485 val fun_too_few_args : Pos.t -> Pos.t -> typing_error_callback -> unit
487 val fun_unexpected_nonvariadic : Pos.t -> Pos.t -> typing_error_callback -> unit
489 val fun_variadicity_hh_vs_php56 :
490 Pos.t -> Pos.t -> typing_error_callback -> unit
492 val expected_tparam :
493 use_pos:Pos.t ->
494 definition_pos:Pos.t ->
495 int ->
496 typing_error_callback option ->
497 unit
499 val object_string : Pos.t -> Pos.t -> unit
501 val object_string_deprecated : Pos.t -> unit
503 val cyclic_typedef : Pos.t -> Pos.t -> unit
505 val type_arity_mismatch :
506 Pos.t -> string -> Pos.t -> string -> typing_error_callback -> unit
508 val this_final : Pos.t * string -> Pos.t -> (Pos.t * string) list
510 val exact_class_final : Pos.t * string -> Pos.t -> (Pos.t * string) list
512 val fun_arity_mismatch : Pos.t -> Pos.t -> typing_error_callback -> unit
514 val discarded_awaitable : Pos.t -> Pos.t -> unit
516 val unify_error : typing_error_callback
518 val unify_error_at : Pos.t -> typing_error_callback
520 val index_type_mismatch : typing_error_callback
522 val expected_stringlike : typing_error_callback
524 val type_constant_mismatch : typing_error_callback -> typing_error_callback
526 val class_constant_type_mismatch :
527 typing_error_callback -> typing_error_callback
529 val constant_does_not_match_enum_type : typing_error_callback
531 val enum_underlying_type_must_be_arraykey : typing_error_callback
533 val enum_constraint_must_be_arraykey : typing_error_callback
535 val enum_subtype_must_have_compatible_constraint : typing_error_callback
537 val parameter_default_value_wrong_type : typing_error_callback
539 val newtype_alias_must_satisfy_constraint : typing_error_callback
541 val bad_function_typevar : typing_error_callback
543 val bad_class_typevar : typing_error_callback
545 val bad_method_typevar : typing_error_callback
547 val missing_return : typing_error_callback
549 val inout_return_type_mismatch : typing_error_callback
551 val class_constant_value_does_not_match_hint : typing_error_callback
553 val class_property_initializer_type_does_not_match_hint : typing_error_callback
555 val xhp_attribute_does_not_match_hint : typing_error_callback
557 val pocket_universes_typing : typing_error_callback
559 val record_init_value_does_not_match_hint : typing_error_callback
561 val static_redeclared_as_dynamic :
562 Pos.t -> Pos.t -> string -> elt_type:[ `Method | `Property ] -> unit
564 val dynamic_redeclared_as_static :
565 Pos.t -> Pos.t -> string -> elt_type:[ `Method | `Property ] -> unit
567 val null_member_read :
568 is_method:bool -> string -> Pos.t -> (Pos.t * string) list -> unit
570 val null_member_write :
571 is_method:bool -> string -> Pos.t -> (Pos.t * string) list -> unit
573 val top_member_read :
574 is_method:bool ->
575 is_nullable:bool ->
576 string ->
577 Pos.t ->
578 string ->
579 Pos.t ->
580 unit
582 val top_member_write :
583 is_method:bool ->
584 is_nullable:bool ->
585 string ->
586 Pos.t ->
587 string ->
588 Pos.t ->
589 unit
591 val non_object_member_read :
592 is_method:bool ->
593 string ->
594 Pos.t ->
595 string ->
596 Pos.t ->
597 typing_error_callback ->
598 unit
600 val non_object_member_write :
601 is_method:bool ->
602 string ->
603 Pos.t ->
604 string ->
605 Pos.t ->
606 typing_error_callback ->
607 unit
609 val unknown_object_member :
610 is_method:bool -> string -> Pos.t -> (Pos.t * string) list -> unit
612 val non_class_member :
613 is_method:bool -> string -> Pos.t -> string -> Pos.t -> unit
615 val null_container : Pos.t -> (Pos.t * string) list -> unit
617 val option_mixed : Pos.t -> unit
619 val option_null : Pos.t -> unit
621 val declared_covariant : Pos.t -> Pos.t -> (Pos.t * string) list -> unit
623 val declared_contravariant : Pos.t -> Pos.t -> (Pos.t * string) list -> unit
625 val static_property_type_generic_param :
626 class_pos:Pos.t -> var_type_pos:Pos.t -> generic_pos:Pos.t -> unit
628 val contravariant_this : Pos.t -> string -> string -> unit
630 val wrong_extend_kind :
631 parent_pos:Pos.t ->
632 parent_kind:Ast_defs.class_kind ->
633 parent_name:string ->
634 child_pos:Pos.t ->
635 child_kind:Ast_defs.class_kind ->
636 child_name:string ->
637 unit
639 val unsatisfied_req : Pos.t -> string -> Pos.t -> unit
641 val cyclic_class_def : SSet.t -> Pos.t -> unit
643 val cyclic_record_def : string list -> Pos.t -> unit
645 val trait_reuse_with_final_method :
646 Pos.t -> string -> string -> (Pos.t * string) list -> unit
648 val trait_reuse : Pos.t -> string -> Pos.t * string -> string -> unit
650 val trait_reuse_inside_class : Pos.t * string -> string -> Pos.t list -> unit
652 val invalid_is_as_expression_hint :
653 string -> Pos.t -> (Pos.t * string) list -> unit
655 val invalid_enforceable_type :
656 string -> Pos.t * string -> Pos.t -> (Pos.t * string) list -> unit
658 val reifiable_attr : Pos.t -> string -> Pos.t -> (Pos.t * string) list -> unit
660 val invalid_newable_type_argument : Pos.t * string -> Pos.t -> unit
662 val invalid_newable_type_param_constraints :
663 Pos.t * string -> string list -> unit
665 val override_final :
666 parent:Pos.t -> child:Pos.t -> on_error:typing_error_callback option -> unit
668 val override_memoizelsb :
669 parent:Pos.t -> child:Pos.t -> typing_error_callback -> unit
671 val override_lsb :
672 member_name:string ->
673 parent:Pos.t ->
674 child:Pos.t ->
675 typing_error_callback ->
676 unit
678 val should_be_override : Pos.t -> string -> string -> unit
680 val override_per_trait : Pos.t * string -> string -> Pos.t -> unit
682 val missing_assign : Pos.t -> unit
684 val private_override : Pos.t -> string -> string -> unit
686 val invalid_memoized_param : Pos.t -> (Pos.t * string) list -> unit
688 val no_construct_parent : Pos.t -> unit
690 val constructor_required : Pos.t * string -> string list -> unit
692 val not_initialized : Pos.t * string -> (Pos.t * string) list -> unit
694 val call_before_init : Pos.t -> string -> unit
696 val type_arity : Pos.t -> Pos.t -> expected:int -> actual:int -> unit
698 val invalid_req_implements : Pos.t -> unit
700 val invalid_req_extends : Pos.t -> unit
702 val abstract_with_body : Pos.t * 'a -> unit
704 val not_abstract_without_body : Pos.t * 'a -> unit
706 val return_in_gen : Pos.t -> unit
708 val return_in_finally : Pos.t -> unit
710 val toplevel_break : Pos.t -> unit
712 val toplevel_continue : Pos.t -> unit
714 val continue_in_switch : Pos.t -> unit
716 val await_in_sync_function : Pos.t -> unit
718 val suspend_in_finally : Pos.t -> unit
720 val static_memoized_function : Pos.t -> unit
722 val magic : Pos.t * string -> unit
724 val non_interface : Pos.t -> string -> string -> unit
726 val toString_returns_string : Pos.t -> unit
728 val toString_visibility : Pos.t -> unit
730 val uses_non_trait : Pos.t -> string -> string -> unit
732 val requires_non_class : Pos.t -> string -> string -> unit
734 val requires_final_class : Pos.t -> string -> unit
736 val abstract_body : Pos.t -> unit
738 val interface_with_member_variable : Pos.t -> unit
740 val interface_with_static_member_variable : Pos.t -> unit
742 val illegal_function_name : Pos.t -> string -> unit
744 val case_fallthrough : Pos.t -> Pos.t -> unit
746 val default_fallthrough : Pos.t -> unit
748 val visibility_extends :
749 string -> Pos.t -> Pos.t -> string -> typing_error_callback -> unit
751 val member_not_implemented : string -> Pos.t -> Pos.t -> Pos.t -> unit
753 val bad_decl_override :
754 Pos.t -> string -> Pos.t -> string -> (Pos.t * string) list -> unit
756 val bad_method_override :
757 Pos.t -> string -> (Pos.t * string) list -> typing_error_callback -> unit
759 val bad_prop_override :
760 Pos.t -> string -> (Pos.t * string) list -> typing_error_callback -> unit
762 val bad_enum_decl : Pos.t -> (Pos.t * string) list -> unit
764 val missing_constructor : Pos.t -> typing_error_callback -> unit
766 val enum_constant_type_bad : Pos.t -> Pos.t -> string -> Pos.t list -> unit
768 val enum_type_bad : Pos.t -> string -> Pos.t list -> unit
770 val enum_type_typedef_nonnull : Pos.t -> unit
772 val enum_switch_redundant : string -> Pos.t -> Pos.t -> unit
774 val enum_switch_nonexhaustive : Pos.t -> string list -> Pos.t -> unit
776 val enum_switch_redundant_default : Pos.t -> Pos.t -> unit
778 val enum_switch_not_const : Pos.t -> unit
780 val enum_switch_wrong_class : Pos.t -> string -> string -> unit
782 val invalid_shape_field_name : Pos.t -> unit
784 val invalid_shape_field_name_empty : Pos.t -> unit
786 val invalid_shape_field_type : Pos.t -> Pos.t -> string -> Pos.t list -> unit
788 val invalid_shape_field_literal : Pos.t -> Pos.t -> unit
790 val invalid_shape_field_const : Pos.t -> Pos.t -> unit
792 val shape_field_class_mismatch : Pos.t -> Pos.t -> string -> string -> unit
794 val shape_field_type_mismatch : Pos.t -> Pos.t -> string -> string -> unit
796 val shape_fields_unknown : Pos.t -> Pos.t -> typing_error_callback -> unit
798 val invalid_shape_remove_key : Pos.t -> unit
800 val using_internal_class : Pos.t -> string -> unit
802 val nullsafe_not_needed : Pos.t -> (Pos.t * string) list -> unit
804 val trivial_strict_eq :
805 Pos.t ->
806 string ->
807 (Pos.t * string) list ->
808 (Pos.t * string) list ->
809 Pos.t list ->
810 Pos.t list ->
811 unit
813 val trivial_strict_not_nullable_compare_null :
814 Pos.t -> string -> (Pos.t * string) list -> unit
816 val void_usage : Pos.t -> (Pos.t * string) list -> unit
818 val noreturn_usage : Pos.t -> (Pos.t * string) list -> unit
820 val generic_at_runtime : Pos.t -> string -> unit
822 val generics_not_allowed : Pos.t -> unit
824 val interface_with_partial_typeconst : Pos.t -> unit
826 val multiple_xhp_category : Pos.t -> unit
828 val mk_multiple_xhp_category : Pos.t -> error
830 val not_abstract_without_typeconst : Pos.t * string -> unit
832 val mk_not_abstract_without_typeconst : Pos.t * string -> error
834 val typeconst_depends_on_external_tparam : Pos.t -> Pos.t -> string -> unit
836 val invalid_type_access_root : Pos.t * string -> unit
838 val duplicate_user_attribute : Pos.t * string -> Pos.t -> unit
840 val unbound_attribute_name : Pos.t -> string -> unit
842 val attribute_too_many_arguments : Pos.t -> string -> int -> unit
844 val attribute_too_few_arguments : Pos.t -> string -> int -> unit
846 val attribute_param_type : Pos.t -> string -> unit
848 val deprecated_use : Pos.t -> ?pos_def:Pos.t option -> string -> unit
850 val cannot_declare_constant :
851 [< `enum | `trait | `record ] -> Pos.t -> Pos.t * string -> unit
853 val ambiguous_inheritance :
854 Pos.t -> string -> string -> error -> typing_error_callback -> unit
856 val duplicate_interface : Pos.t -> string -> Pos.t list -> unit
858 val cyclic_typeconst : Pos.t -> string list -> unit
860 val abstract_concrete_override :
861 Pos.t -> Pos.t -> [< `method_ | `typeconst | `constant | `property ] -> unit
863 val local_variable_modified_and_used : Pos.t -> Pos.t list -> unit
865 val local_variable_modified_twice : Pos.t -> Pos.t list -> unit
867 val assign_during_case : Pos.t -> unit
869 val cyclic_enum_constraint : Pos.t -> unit
871 val invalid_classname : Pos.t -> unit
873 val illegal_type_structure : Pos.t -> string -> unit
875 val illegal_typeconst_direct_access : Pos.t -> unit
877 val override_no_default_typeconst : Pos.t -> Pos.t -> unit
879 val unification_cycle : Pos.t -> string -> unit
881 val eq_incompatible_types :
882 Pos.t -> (Pos.t * string) list -> (Pos.t * string) list -> unit
884 val comparison_invalid_types :
885 Pos.t -> (Pos.t * string) list -> (Pos.t * string) list -> unit
887 val invalid_new_disposable : Pos.t -> unit
889 val invalid_disposable_hint : Pos.t -> string -> unit
891 val invalid_disposable_return_hint : Pos.t -> string -> unit
893 val invalid_return_disposable : Pos.t -> unit
895 val invalid_switch_case_value_type : Pos.t -> string -> string -> unit
897 val to_json : Pos.absolute error_ -> Hh_json.json
899 val convert_errors_to_string :
900 ?include_filename:bool -> error list -> string list
902 val combining_sort : 'a list -> f:('a -> string) -> 'a list
904 val to_string : Pos.absolute error_ -> string
906 val format_summary :
907 format -> 'a error_ list -> int -> int option -> string option
909 val try_ : (unit -> 'a) -> (error -> 'a) -> 'a
911 val try_with_result : (unit -> 'a) -> ('a -> error -> 'a) -> 'a
913 val try_with_error : (unit -> 'a) -> (unit -> 'a) -> 'a
915 (* The type of collections of errors *)
916 type t [@@deriving eq]
918 val do_ : (unit -> 'a) -> t * 'a
920 val do_with_context : Relative_path.t -> phase -> (unit -> 'a) -> t * 'a
922 val run_in_context : Relative_path.t -> phase -> (unit -> 'a) -> 'a
924 val run_in_decl_mode : Relative_path.t -> (unit -> 'a) -> 'a
926 (* Run this function with span for the definition being checked.
927 * This is used to check that the primary position for errors is not located
928 * outside the span of the definition.
930 val run_with_span : Pos.t -> (unit -> 'a) -> 'a
932 (** ignore errors produced by function passed in argument. *)
933 val ignore_ : (unit -> 'a) -> 'a
935 val try_when : (unit -> 'a) -> when_:(unit -> bool) -> do_:(error -> unit) -> 'a
937 val has_no_errors : (unit -> 'a) -> bool
939 val currently_has_errors : unit -> bool
941 val to_absolute : error -> Pos.absolute error_
943 val to_absolute_for_test : error -> Pos.absolute error_
945 val merge : t -> t -> t
947 val merge_into_current : t -> unit
949 val incremental_update_set :
950 old:t -> new_:t -> rechecked:Relative_path.Set.t -> phase -> t
952 val incremental_update_map :
953 old:t -> new_:t -> rechecked:'a Relative_path.Map.t -> phase -> t
955 val empty : t
957 val is_empty : t -> bool
959 val count : t -> int
961 val get_error_list : t -> error list
963 val get_sorted_error_list : t -> error list
965 val from_error_list : error list -> t
967 val iter_error_list : (error -> unit) -> t -> unit
969 val fold_errors :
970 ?phase:phase -> t -> init:'a -> f:(Relative_path.t -> error -> 'a -> 'a) -> 'a
972 val fold_errors_in :
973 ?phase:phase ->
974 t ->
975 source:Relative_path.t ->
976 init:'a ->
977 f:(error -> 'a -> 'a) ->
980 val get_failed_files : t -> phase -> Relative_path.Set.t
982 val sort : error list -> error list
984 val get_applied_fixmes : t -> applied_fixme list
986 val too_few_type_arguments : Pos.t -> unit
988 val required_field_is_optional :
989 Pos.t -> Pos.t -> string -> typing_error_callback -> unit
991 val array_get_with_optional_field : Pos.t -> Pos.t -> string -> unit
993 val goto_label_already_defined : string -> Pos.t -> Pos.t -> unit
995 val goto_label_undefined : Pos.t -> string -> unit
997 val goto_label_defined_in_finally : Pos.t -> unit
999 val goto_invoked_in_finally : Pos.t -> unit
1001 val method_needs_visibility : Pos.t -> unit
1003 val mk_method_needs_visibility : Pos.t -> error
1005 val dynamic_class_name_in_strict_mode : Pos.t -> unit
1007 val reading_from_append : Pos.t -> unit
1009 val nullable_cast : Pos.t -> string -> Pos.t -> unit
1011 val return_disposable_mismatch :
1012 bool -> Pos.t -> Pos.t -> typing_error_callback -> unit
1014 val fun_reactivity_mismatch :
1015 Pos.t -> string -> Pos.t -> string -> typing_error_callback -> unit
1017 val reassign_mutable_var : in_collection:bool -> Pos.t -> unit
1019 val mutable_call_on_immutable : Pos.t -> Pos.t -> Pos.t option -> unit
1021 val mutable_argument_mismatch : Pos.t -> Pos.t -> unit
1023 val invalid_mutable_return_result : Pos.t -> Pos.t -> string -> unit
1025 val mutable_return_result_mismatch :
1026 bool -> Pos.t -> Pos.t -> typing_error_callback -> unit
1028 val mutable_methods_must_be_reactive : Pos.t -> string -> unit
1030 val mutable_return_annotated_decls_must_be_reactive :
1031 string -> Pos.t -> string -> unit
1033 val pu_expansion : Pos.t -> string -> string -> unit
1035 val pu_typing : Pos.t -> string -> string -> unit
1037 val pu_typing_not_supported : Pos.t -> unit
1039 val pu_typing_invalid_upper_bounds : Pos.t -> unit
1041 val pu_typing_refinement : Pos.t -> unit
1043 val pu_atom_missing : Pos.t -> string -> string -> string -> string -> unit
1045 val pu_atom_unknown : Pos.t -> string -> string -> string -> string -> unit
1047 val pu_localize : Pos.t -> string -> string -> unit
1049 val pu_invalid_access : Pos.t -> string -> unit
1051 val pu_case_in_trait : Pos.t -> string -> unit
1053 val pu_attribute_invalid : Pos.t -> unit
1055 val pu_attribute_err : Pos.t -> string -> string -> string -> string -> unit
1057 val pu_attribute_dup : Pos.t -> string -> string -> unit
1059 val pu_attribute_suggestion : Pos.t -> string -> string -> unit
1061 val pu_attribute_not_necessary : Pos.t -> string -> unit
1063 val lvar_in_obj_get : Pos.t -> unit
1065 val invalid_freeze_target : Pos.t -> Pos.t -> string -> unit
1067 val invalid_freeze_use : Pos.t -> unit
1069 val freeze_in_nonreactive_context : Pos.t -> unit
1071 val this_as_lexical_variable : Pos.t -> unit
1073 val dollardollar_lvalue : Pos.t -> unit
1075 val duplicate_using_var : Pos.t -> unit
1077 val illegal_disposable : Pos.t -> string -> unit
1079 val escaping_disposable : Pos.t -> unit
1081 val escaping_disposable_parameter : Pos.t -> unit
1083 val escaping_this : Pos.t -> unit
1085 val must_extend_disposable : Pos.t -> unit
1087 val accept_disposable_invariant :
1088 Pos.t -> Pos.t -> typing_error_callback -> unit
1090 val inout_params_special : Pos.t -> unit
1092 val inout_params_memoize : Pos.t -> Pos.t -> unit
1094 val obj_set_reactive : Pos.t -> unit
1096 val static_property_in_reactive_context : Pos.t -> unit
1098 val inout_annotation_missing : Pos.t -> Pos.t -> unit
1100 val inout_annotation_unexpected : Pos.t -> Pos.t -> bool -> unit
1102 val inoutness_mismatch : Pos.t -> Pos.t -> typing_error_callback -> unit
1104 val xhp_required : Pos.t -> string -> (Pos.t * string) list -> unit
1106 val illegal_xhp_child : Pos.t -> (Pos.t * string) list -> unit
1108 val missing_xhp_required_attr : Pos.t -> string -> (Pos.t * string) list -> unit
1110 val nonreactive_function_call : Pos.t -> Pos.t -> string -> Pos.t option -> unit
1112 val nonpure_function_call : Pos.t -> Pos.t -> string -> unit
1114 val nonreactive_indexing : bool -> Pos.t -> unit
1116 val inout_argument_bad_expr : Pos.t -> unit
1118 val inout_argument_bad_type : Pos.t -> (Pos.t * string) list -> unit
1120 val nonreactive_call_from_shallow :
1121 Pos.t -> Pos.t -> string -> Pos.t option -> unit
1123 val illegal_destructor : Pos.t -> unit
1125 val rx_enabled_in_non_rx_context : Pos.t -> unit
1127 val ambiguous_lambda : Pos.t -> (Pos.t * string) list -> unit
1129 val ellipsis_strict_mode :
1130 require:[< `Param_name | `Type | `Type_and_param_name ] -> Pos.t -> unit
1132 val untyped_lambda_strict_mode : Pos.t -> unit
1134 val multiple_conditionally_reactive_annotations : Pos.t -> string -> unit
1136 val conditionally_reactive_annotation_invalid_arguments :
1137 is_method:bool -> Pos.t -> unit
1139 val echo_in_reactive_context : Pos.t -> unit
1141 val superglobal_in_reactive_context : Pos.t -> string -> unit
1143 val rx_is_enabled_invalid_location : Pos.t -> unit
1145 val wrong_expression_kind_attribute :
1146 string -> Pos.t -> string -> Pos.t -> string -> string -> unit
1148 val wrong_expression_kind_builtin_attribute : string -> Pos.t -> string -> unit
1150 val cannot_return_borrowed_value_as_immutable : Pos.t -> Pos.t -> unit
1152 val decl_override_missing_hint : Pos.t -> typing_error_callback -> unit
1154 val atmost_rx_as_rxfunc_invalid_location : Pos.t -> unit
1156 val no_atmost_rx_as_rxfunc_for_rx_if_args : Pos.t -> unit
1158 val pu_duplication : Pos.t -> string -> string -> string -> unit
1160 val pu_duplication_in_instance : Pos.t -> string -> string -> string -> unit
1162 val pu_not_in_class : Pos.t -> string -> string -> unit
1164 val illegal_use_of_dynamically_callable : Pos.t -> Pos.t -> string -> unit
1166 val dynamically_callable_reified : Pos.t -> unit
1168 val parent_in_function_pointer : Pos.t -> string option -> string -> unit
1170 val self_in_non_final_function_pointer :
1171 Pos.t -> string option -> string -> unit
1173 val invalid_type_for_atmost_rx_as_rxfunc_parameter : Pos.t -> string -> unit
1175 val missing_annotation_for_atmost_rx_as_rxfunc_parameter : Pos.t -> unit
1177 val mutable_in_nonreactive_context : Pos.t -> unit
1179 val invalid_argument_of_rx_mutable_function : Pos.t -> unit
1181 val return_void_to_rx_mismatch :
1182 pos1_has_attribute:bool -> Pos.t -> Pos.t -> typing_error_callback -> unit
1184 val returns_void_to_rx_function_as_non_expression_statement :
1185 Pos.t -> Pos.t -> unit
1187 val non_awaited_awaitable_in_rx : Pos.t -> unit
1189 val shapes_key_exists_always_true : Pos.t -> string -> Pos.t -> unit
1191 val shapes_key_exists_always_false :
1192 Pos.t ->
1193 string ->
1194 Pos.t ->
1195 [< `Undefined | `Nothing of (Pos.t * string) list ] ->
1196 unit
1198 val shapes_method_access_with_non_existent_field :
1199 Pos.t ->
1200 string ->
1201 Pos.t ->
1202 string ->
1203 [< `Undefined | `Nothing of (Pos.t * string) list ] ->
1204 unit
1206 val shape_access_with_non_existent_field :
1207 Pos.t ->
1208 string ->
1209 Pos.t ->
1210 [< `Undefined | `Nothing of (Pos.t * string) list ] ->
1211 unit
1213 val ambiguous_object_access :
1214 Pos.t -> string -> Pos.t -> string -> Pos.t -> string -> string -> unit
1216 val unserializable_type : Pos.t -> string -> unit
1218 val invalid_arraykey_read : Pos.t -> Pos.t * string -> Pos.t * string -> unit
1220 val invalid_arraykey_write : Pos.t -> Pos.t * string -> Pos.t * string -> unit
1222 val invalid_arraykey_constraint : Pos.t -> string -> unit
1224 val invalid_argument_type_for_condition_in_rx :
1225 is_receiver:bool -> Pos.t -> Pos.t -> Pos.t -> string -> string -> unit
1227 val callsite_reactivity_mismatch :
1228 Pos.t -> Pos.t -> string -> Pos.t option -> string -> unit
1230 val callsite_cipp_mismatch : Pos.t -> Pos.t -> string -> string -> unit
1232 val rx_parameter_condition_mismatch :
1233 string -> Pos.t -> Pos.t -> typing_error_callback -> unit
1235 val conflicting_mutable_and_maybe_mutable_attributes : Pos.t -> unit
1237 val maybe_mutable_methods_must_be_reactive : Pos.t -> string -> unit
1239 val entrypoint_arguments : Pos.t -> unit
1241 val variadic_memoize : Pos.t -> unit
1243 val abstract_method_memoize : Pos.t -> unit
1245 val instance_property_in_abstract_final_class : Pos.t -> unit
1247 val reassign_maybe_mutable_var : in_collection:bool -> Pos.t -> unit
1249 val immutable_argument_mismatch : Pos.t -> Pos.t -> unit
1251 val maybe_mutable_argument_mismatch : Pos.t -> Pos.t -> unit
1253 val immutable_call_on_mutable : Pos.t -> Pos.t -> unit
1255 val invalid_call_on_maybe_mutable :
1256 fun_is_mutable:bool -> Pos.t -> Pos.t -> unit
1258 val mutability_mismatch :
1259 is_receiver:bool ->
1260 Pos.t ->
1261 string ->
1262 Pos.t ->
1263 string ->
1264 typing_error_callback ->
1265 unit
1267 val invalid_traversable_in_rx : Pos.t -> unit
1269 val reassign_mutable_this :
1270 in_collection:bool -> is_maybe_mutable:bool -> Pos.t -> unit
1272 val mutable_expression_as_multiple_mutable_arguments :
1273 Pos.t -> string -> Pos.t -> string -> unit
1275 val invalid_unset_target_rx : Pos.t -> unit
1277 val lateinit_with_default : Pos.t -> unit
1279 val bad_lateinit_override :
1280 bool -> Pos.t -> Pos.t -> typing_error_callback -> unit
1282 val bad_xhp_attr_required_override :
1283 string -> string -> Pos.t -> Pos.t -> typing_error_callback -> unit
1285 val interface_use_trait : Pos.t -> unit
1287 val nonstatic_method_in_abstract_final_class : Pos.t -> unit
1289 val escaping_mutable_object : Pos.t -> unit
1291 val multiple_concrete_defs :
1292 Pos.t ->
1293 Pos.t ->
1294 string ->
1295 string ->
1296 string ->
1297 string ->
1298 typing_error_callback ->
1299 unit
1301 val move_in_nonreactive_context : Pos.t -> unit
1303 val invalid_move_target : Pos.t -> Pos.t -> string -> unit
1305 val invalid_move_use : Pos.t -> unit
1307 val require_args_reify : Pos.t -> Pos.t -> unit
1309 val require_generic_explicit : Pos.t * string -> Pos.t -> unit
1311 val invalid_reified_argument :
1312 Pos.t * string -> Pos.t -> (Pos.t * string) list -> unit
1314 val invalid_reified_argument_reifiable :
1315 Pos.t * string -> Pos.t -> Pos.t -> string -> unit
1317 val new_static_class_reified : Pos.t -> unit
1319 val class_get_reified : Pos.t -> unit
1321 val consistent_construct_reified : Pos.t -> unit
1323 val reified_generics_not_allowed : Pos.t -> unit
1325 val bad_function_pointer_construction : Pos.t -> unit
1327 val new_without_newable : Pos.t -> string -> unit
1329 val mutably_owned_argument_mismatch :
1330 arg_is_owned_local:bool -> Pos.t -> Pos.t -> unit
1332 val rx_move_invalid_location : Pos.t -> unit
1334 val inconsistent_mutability : Pos.t -> string -> (Pos.t * string) option -> unit
1336 val invalid_mutability_flavor : Pos.t -> string -> string -> unit
1338 val inconsistent_mutability_for_conditional : Pos.t -> Pos.t -> unit
1340 val redundant_rx_condition : Pos.t -> unit
1342 val misplaced_mutability_hint : Pos.t -> unit
1344 val mutability_hint_in_non_rx_function : Pos.t -> unit
1346 val invalid_mutability_in_return_type_hint : Pos.t -> unit
1348 val typechecker_timeout : Pos.t * string -> int -> unit
1350 val switch_multiple_default : Pos.t -> unit
1352 val switch_non_terminal_default : Pos.t -> unit
1354 val unsupported_trait_use_as : Pos.t -> unit
1356 val mk_unsupported_trait_use_as : Pos.t -> error
1358 val unsupported_instead_of : Pos.t -> unit
1360 val mk_unsupported_instead_of : Pos.t -> error
1362 val invalid_trait_use_as_visibility : Pos.t -> unit
1364 val mk_invalid_trait_use_as_visibility : Pos.t -> error
1366 val unresolved_type_variable : Pos.t -> unit
1368 val invalid_sub_string : Pos.t -> string -> unit
1370 val php_lambda_disallowed : Pos.t -> unit
1372 val static_meth_with_class_reified_generic : Pos.t -> Pos.t -> unit
1374 val exception_occurred : Pos.t -> Exception.t -> unit
1376 val redundant_covariant : Pos.t -> string -> string -> unit
1378 val meth_caller_trait : Pos.t -> string -> unit
1380 val unsupported_hk_feature :
1381 because_nested:bool -> Pos.t -> string -> string -> unit
1383 val tparam_non_shadowing_reuse : Pos.t -> string -> unit
1385 val illegal_information_flow :
1386 Pos.t -> Pos.t list -> Pos.t list * string -> Pos.t list * string -> unit
1388 val context_implicit_policy_leakage :
1389 Pos.t -> Pos.t list -> Pos.t list * string -> Pos.t list * string -> unit
1391 val unknown_information_flow : Pos.t -> string -> unit
1393 val reified_function_reference : Pos.t -> unit
1395 val class_meth_abstract_call : string -> string -> Pos.t -> Pos.t -> unit
1397 val higher_kinded_partial_application : Pos.t -> int -> unit
1399 val wildcard_for_higher_kinded_type : Pos.t -> unit
1401 val implicit_type_argument_for_higher_kinded_type :
1402 use_pos:Pos.t -> def_pos:Pos.t -> string -> unit
1404 val kind_mismatch :
1405 use_pos:Pos.t ->
1406 def_pos:Pos.t ->
1407 tparam_name:string ->
1408 expected_kind_repr:string ->
1409 actual_kind_repr:string ->
1410 unit
1412 val class_with_constraints_used_as_hk_type : Pos.t -> string -> unit
1414 val alias_with_implicit_constraints_as_hk_type :
1415 use_pos:Pos.t ->
1416 typedef_pos:Pos.t ->
1417 used_class_in_def_pos:Pos.t ->
1418 typedef_name:string ->
1419 typedef_tparam_name:string ->
1420 used_class_in_def_name:string ->
1421 used_class_tparam_name:string ->
1422 unit
1424 val reinheriting_classish_const :
1425 Pos.t -> string -> Pos.t -> string -> string -> string -> unit
1427 val redeclaring_classish_const :
1428 Pos.t -> string -> Pos.t -> string -> string -> unit
1430 val incompatible_enum_inclusion_base : Pos.t -> string -> string -> unit
1432 val incompatible_enum_inclusion_constraint : Pos.t -> string -> string -> unit
1434 val enum_inclusion_not_enum : Pos.t -> string -> string -> unit
1436 val call_coeffect_error : Pos.t -> Pos.t -> string -> Pos.t -> string -> unit
1438 val abstract_function_pointer : string -> string -> Pos.t -> Pos.t -> unit