2 * Copyright (c) 2015, 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.
10 (* Naming conventions in this file:
11 - tco_<feature/flag/setting> - type checker option
12 - po_<feature/flag/setting> - parser option
13 - so_<feature/flag/setting> - server option
18 * Enforces array subtyping relationships.
20 * There are a few kinds of arrays in Hack:
21 * 1. array: This is a type parameter-less array, that behaves like a PHP
22 * array, but may be used in place of the arrays listed below.
23 * 2. array<T>: This is a vector-like array. It may be implemented with a
24 * compact representation. Keys are integer indices. Values are of type T.
25 * 3. array<Tk, Tv>: This is a dictionary-like array. It is generally
26 * implemented as a hash table. Keys are of type Tk. Values are of type
29 * Unfortunately, there is no consistent subtyping relationship between these
31 * 1. An array<T> may be provided where an array is required.
32 * 2. An array may be provided where an array<T> is required.
33 * 3. An array<Tk, Tv> may be provided where an array is required.
34 * 4. An array may be provided where an array<Tk, Tv> is required.
36 * This option enforces a stricter subtyping relationship within these types.
37 * In particular, when enabled, points 2. and 4. from the above list become
40 tco_safe_array
: bool;
43 * Enforces that a vector-like array may not be used where a hashtable-like
46 * When disabled, Hack assumes the following:
48 * array<T> <: array<int, T>
50 * When enabled, there is no subtyping relationship between array<T> and
53 tco_safe_vector_array
: bool;
55 (* Set of experimental features, in lowercase. *)
56 tco_experimental_features
: SSet.t
;
58 (* Set of opt-in migration behavior flags, in lowercase. *)
59 tco_migration_flags
: SSet.t
;
61 (* Whether to treat Tany as Tdynamic *)
62 tco_dynamic_view
: bool;
64 (* If set, defers class declarations after N lazy declarations; if not set,
65 always lazily declares classes not already in cache. *)
66 tco_defer_class_declaration_threshold
: int option;
68 (* If set, distributes type checking to remote workers if the number of files to
69 type check exceeds the threshold. If not set, then always checks everything locally. *)
70 tco_remote_type_check_threshold
: int option;
72 (* If set, uses the key to fetch type checking jobs *)
73 tco_remote_worker_key
: string option;
75 (* If set, uses the check ID when logging events in the context of remove init/work *)
76 tco_remote_check_id
: string option;
78 (* Dictates the number of remote type checking workers *)
79 tco_num_remote_workers
: int;
81 (* Above this threshold of files to check, the remote type checking worker will not use Eden *)
82 so_remote_worker_eden_checkout_threshold
: int;
84 (* Enables the reverse naming table to fall back to SQLite for queries. *)
85 so_naming_sqlite_path
: string option;
87 (* Flag to disallow subtyping of untyped arrays and tuples (both ways) *)
88 tco_disallow_array_as_tuple
: bool;
90 (* Namespace aliasing map *)
91 po_auto_namespace_map
: (string * string) list
;
93 (* Are we emitting bytecode? *)
96 (* Flag for disabling functions in HHI files with the __PHPStdLib attribute *)
97 po_deregister_php_stdlib
: bool;
99 (* Flag to disable the backticks execution operator *)
100 po_disallow_execution_operator
: bool;
102 (* Flag to disable PHP's non-top-level declarations *)
103 po_disable_nontoplevel_declarations
: bool;
105 (* Flag to disable PHP's static closures *)
106 po_disable_static_closures
: bool;
108 (* Flag to enable PHP's `goto` operator *)
111 (** Print types of size bigger than 1000 after performing a type union. *)
112 tco_log_inference_constraints
: bool;
115 * Flag to disallow any lambda that has to be checked using the legacy
118 tco_disallow_ambiguous_lambda
: bool;
121 * Flag to disallow array typehints
123 tco_disallow_array_typehint
: bool;
126 * Flag to disallow array literal expressions
128 tco_disallow_array_literal
: bool;
131 * Flag to enable logging of statistics regarding use of language features.
132 * Currently used for lambdas.
134 tco_language_feature_logging
: bool;
137 * Flag to disable enforcement of requirements for reactive Hack.
139 * Currently defaults to true as Reactive Hack is experimental and
140 * undocumented; the HSL is compatible with it, but we don't want to
141 * raise errors that can't be fully understood without knowledge of
142 * undocumented features.
144 tco_unsafe_rx
: bool;
147 * Flag to disallow implicit and expressionless returns in non-void functions.
149 tco_disallow_implicit_returns_in_non_void_functions
: bool;
152 * Flag to disable unsetting on varray / varray_or_darray.
154 tco_disallow_unset_on_varray
: bool;
157 * When enabled, mismatches between the types of the scrutinee and case value
158 * of a switch expression are reported as type errors.
160 tco_disallow_scrutinee_case_value_type_mismatch
: bool;
163 * Flag to disallow (string) casting non-Stringish values
165 tco_disallow_stringish_magic
: bool;
168 * Constraint-based type inference for lambdas
170 tco_new_inference_lambda
: bool;
173 * If non-zero, give up type checking a class or function after this many seconds
178 * Flag to disallow using values that get casted to array keys at runtime;
179 * like bools, floats, or null; as array keys.
181 tco_disallow_invalid_arraykey
: bool;
184 * Produces an error if an arguments is passed by reference to dynamically
185 * called function [e.g. $foo(&$bar)].
187 tco_disallow_byref_dynamic_calls
: bool;
190 * Produces an error if an arguments is passed by reference in any form
193 tco_disallow_byref_calls
: bool;
195 (* Make usage of the `instanceof` operator a parse error. *)
196 po_disable_instanceof
: bool;
198 (* Error codes for which we do not allow HH_FIXMEs *)
199 ignored_fixme_codes
: ISet.t
;
202 * Regular expression controlling which HH_FIXMEs are to be ignored by the
205 ignored_fixme_regex
: string option;
207 (* Initial hh_log_level settings *)
208 log_levels
: int SMap.t
;
210 (* Flag to disable using lvals as expressions. *)
211 po_disable_lval_as_an_expression
: bool;
213 (* Flag to typecheck xhp code *)
214 tco_typecheck_xhp_cvars
: bool;
216 (* Flag to ignore the string in vec<string>[...] *)
217 tco_ignore_collection_expr_type_arguments
: bool;
219 (* Look up class members lazily from shallow declarations instead of eagerly
220 computing folded declarations representing the entire class type. *)
221 tco_shallow_class_decl
: bool;
223 (* Use Rust parser *)
226 (* Enables deeper like types features *)
227 tco_like_types
: bool;
229 (* This tells the type checker to rewrite unenforceable as like types
230 i.e. vec<string> => vec<~string> *)
231 tco_pessimize_types
: bool;
233 (* Enables coercion from dynamic and like types to enforceable types
234 i.e. dynamic ~> int, ~string ~> string *)
235 tco_coercion_from_dynamic
: bool;
237 (* Treat partially abstract typeconsts like concrete typeconsts, disable overriding type *)
238 tco_disable_partially_abstract_typeconsts
: bool;
240 (* Set of codes to be treated as if they were in strict mode files *)
241 error_codes_treated_strictly
: ISet.t
;
243 (* static check xhp required attribute *)
244 tco_check_xhp_attribute
: bool;
247 * Flag to produce an error whenever the TAST contains unresolved type variables
249 tco_disallow_unresolved_type_variables
: bool;
251 (* Disallow using non-string, non-int types as array key type constraints. *)
252 tco_disallow_invalid_arraykey_constraint
: bool;
254 (* Enable constants to have visibility modifiers *)
255 po_enable_constant_visibility_modifiers
: bool;
257 (* Enable class-level where clauses, i.e.
258 class base<T> where T = int {} *)
259 po_enable_class_level_where_clauses
: bool;
261 (* Disable legacy soft typehint syntax (@int) and only allow the __Soft attribute. *)
262 po_disable_legacy_soft_typehints
: bool;
264 (* Use shared_lru workers instead of MultiWorker workers *)
265 tco_use_lru_workers
: bool;
267 (* Split 4110 into a variety of more specific errors *)
268 use_new_type_errors
: bool;
270 (* Disable ${x} syntax for string interpolation in Hack and only allow {$x} *)
271 po_disable_outside_dollar_str_interp
: bool;
273 (* Force 5000s to be @lint-ignored rather than fixme'd *)
274 disable_linter_fixmes
: bool;
279 ?tco_safe_array
: bool ->
280 ?tco_safe_vector_array
: bool ->
281 ?po_deregister_php_stdlib
: bool ->
282 ?po_disallow_execution_operator
: bool ->
283 ?po_disable_nontoplevel_declarations
: bool ->
284 ?po_disable_static_closures
: bool ->
285 ?po_allow_goto
: bool ->
286 ?tco_log_inference_constraints
: bool ->
287 ?tco_experimental_features
: SSet.t
->
288 ?tco_migration_flags
: SSet.t
->
289 ?tco_dynamic_view
: bool ->
290 ?tco_defer_class_declaration_threshold
: int ->
291 ?tco_remote_type_check_threshold
: int ->
292 ?tco_remote_worker_key
: string ->
293 ?tco_remote_check_id
: string ->
294 ?tco_num_remote_workers
: int ->
295 ?so_remote_worker_eden_checkout_threshold
: int ->
296 ?so_naming_sqlite_path
: string ->
297 ?tco_disallow_array_as_tuple
: bool ->
298 ?po_auto_namespace_map
: (string * string) list
->
299 ?tco_disallow_ambiguous_lambda
: bool ->
300 ?tco_disallow_array_typehint
: bool ->
301 ?tco_disallow_array_literal
: bool ->
302 ?tco_language_feature_logging
: bool ->
303 ?tco_unsafe_rx
: bool ->
304 ?tco_disallow_implicit_returns_in_non_void_functions
: bool ->
305 ?tco_disallow_unset_on_varray
: bool ->
306 ?tco_disallow_scrutinee_case_value_type_mismatch
: bool ->
307 ?tco_disallow_stringish_magic
: bool ->
308 ?tco_new_inference_lambda
: bool ->
310 ?tco_disallow_invalid_arraykey
: bool ->
311 ?tco_disallow_byref_dynamic_calls
: bool ->
312 ?tco_disallow_byref_calls
: bool ->
313 ?po_disable_instanceof
: bool ->
314 ?ignored_fixme_codes
: ISet.t
->
315 ?ignored_fixme_regex
: string ->
316 ?log_levels
: int SMap.t
->
317 ?po_disable_lval_as_an_expression
: bool ->
318 ?tco_typecheck_xhp_cvars
: bool ->
319 ?tco_ignore_collection_expr_type_arguments
: bool ->
320 ?tco_shallow_class_decl
: bool ->
322 ?tco_like_types
: bool ->
323 ?tco_pessimize_types
: bool ->
324 ?tco_coercion_from_dynamic
: bool ->
325 ?tco_disable_partially_abstract_typeconsts
: bool ->
326 ?error_codes_treated_strictly
: ISet.t
->
327 ?tco_check_xhp_attribute
: bool ->
328 ?tco_disallow_unresolved_type_variables
: bool ->
329 ?tco_disallow_invalid_arraykey_constraint
: bool ->
330 ?po_enable_constant_visibility_modifiers
: bool ->
331 ?po_enable_class_level_where_clauses
: bool ->
332 ?po_disable_legacy_soft_typehints
: bool ->
333 ?tco_use_lru_workers
: bool ->
334 ?use_new_type_errors
: bool ->
335 ?po_disable_outside_dollar_str_interp
: bool ->
336 ?disable_linter_fixmes
: bool ->
340 val tco_safe_array
: t
-> bool
341 val tco_safe_vector_array
: t
-> bool
342 val tco_experimental_feature_enabled
: t
-> SSet.elt
-> bool
343 val tco_migration_flag_enabled
: t
-> SSet.elt
-> bool
344 val tco_dynamic_view
: t
-> bool
345 val tco_defer_class_declaration_threshold
: t
-> int option
346 val tco_remote_type_check_threshold
: t
-> int option
347 val tco_remote_worker_key
: t
-> string option
348 val tco_remote_check_id
: t
-> string option
349 val tco_num_remote_workers
: t
-> int
350 val so_remote_worker_eden_checkout_threshold
: t
-> int
351 val so_naming_sqlite_path
: t
-> string option
352 val tco_disallow_array_as_tuple
: t
-> bool
353 val po_auto_namespace_map
: t
-> (string * string) list
354 val po_deregister_php_stdlib
: t
-> bool
355 val po_disallow_execution_operator
: t
-> bool
356 val po_disable_nontoplevel_declarations
: t
-> bool
357 val po_disable_static_closures
: t
-> bool
358 val po_allow_goto
: t
-> bool
359 val po_codegen
: t
-> bool
360 val tco_log_inference_constraints
: t
-> bool
361 val tco_disallow_ambiguous_lambda
: t
-> bool
362 val tco_disallow_array_typehint
: t
-> bool
363 val tco_disallow_array_literal
: t
-> bool
364 val tco_language_feature_logging
: t
-> bool
365 val tco_unsafe_rx
: t
-> bool
366 val tco_disallow_implicit_returns_in_non_void_functions
: t
-> bool
367 val tco_disallow_unset_on_varray
: t
-> bool
368 val tco_disallow_scrutinee_case_value_type_mismatch
: t
-> bool
369 val tco_disallow_stringish_magic
: t
-> bool
370 val tco_new_inference_lambda
: t
-> bool
371 val tco_timeout
: t
-> int
372 val tco_disallow_invalid_arraykey
: t
-> bool
373 val tco_disallow_byref_dynamic_calls
: t
-> bool
374 val tco_disallow_byref_calls
: t
-> bool
375 val po_disable_instanceof
: t
-> bool
377 val tco_experimental_instanceof
: string
378 val tco_experimental_isarray
: string
379 val tco_experimental_goto
: string
380 val tco_experimental_disable_shape_and_tuple_arrays
: string
381 val tco_experimental_stronger_shape_idx_ret
: string
382 val tco_experimental_unresolved_fix
: string
383 val tco_experimental_generics_arity
: string
384 val tco_experimental_annotate_function_calls
: string
385 val tco_experimental_forbid_nullable_cast
: string
386 val tco_experimental_coroutines
: string
387 val tco_experimental_disallow_static_memoized
: string
388 val tco_experimental_no_trait_reuse
: string
389 val tco_experimental_type_param_shadowing
: string
390 val tco_experimental_trait_method_redeclarations
: string
391 val tco_experimental_type_const_attributes
: string
392 val tco_experimental_decl_linearization
: string
393 val tco_experimental_track_subtype_prop
: string
394 val tco_experimental_pocket_universes
: string
395 val tco_experimental_abstract_type_const_with_default
: string
396 val tco_experimental_all
: SSet.t
397 val tco_migration_flags_all
: SSet.t
398 val ignored_fixme_codes
: t
-> ISet.t
399 val ignored_fixme_regex
: t
-> string option
400 val log_levels
: t
-> int SMap.t
401 val po_disable_lval_as_an_expression
: t
-> bool
402 val setup_pocket_universes
: t
-> bool -> t
403 val tco_typecheck_xhp_cvars
: t
-> bool
404 val tco_ignore_collection_expr_type_arguments
: t
-> bool
405 val tco_shallow_class_decl
: t
-> bool
406 val po_rust
: t
-> bool
407 val tco_like_types
: t
-> bool
408 val tco_pessimize_types
: t
-> bool
409 val tco_coercion_from_dynamic
: t
-> bool
410 val tco_disable_partially_abstract_typeconsts
: t
-> bool
411 val error_codes_treated_strictly
: t
-> ISet.t
412 val tco_check_xhp_attribute
: t
-> bool
413 val tco_disallow_unresolved_type_variables
: t
-> bool
414 val tco_disallow_invalid_arraykey_constraint
: t
-> bool
415 val po_enable_constant_visibility_modifiers
: t
-> bool
416 val po_enable_class_level_where_clauses
: t
-> bool
417 val po_disable_legacy_soft_typehints
: t
-> bool
418 val tco_use_lru_workers
: t
-> bool
419 val use_new_type_errors
: t
-> bool
420 val po_disable_outside_dollar_str_interp
: t
-> bool
421 val disable_linter_fixmes
: t
-> bool