1 // Copyright (c) Facebook, Inc. and its affiliates.
3 // This source code is licensed under the MIT license found in the
4 // LICENSE file in the "hack" directory of this source tree.
6 use crate::{gen::global_options::GlobalOptions, i_set, s_map, s_set};
8 const DEFAULT: GlobalOptions<'_> = GlobalOptions {
9 tco_experimental_features: s_set::SSet::empty(),
10 tco_migration_flags: s_set::SSet::empty(),
11 tco_dynamic_view: false,
12 tco_num_local_workers: None,
13 tco_parallel_type_checking_threshold: 10,
14 tco_max_typechecker_worker_memory_mb: None,
15 tco_defer_class_declaration_threshold: None,
16 tco_defer_class_memory_mb_threshold: None,
17 tco_max_times_to_defer_type_checking: None,
18 tco_prefetch_deferred_files: false,
19 tco_remote_type_check_threshold: None,
20 tco_remote_type_check: false,
21 tco_remote_worker_key: None,
22 tco_remote_check_id: None,
23 tco_remote_max_batch_size: 8000,
24 tco_remote_min_batch_size: 5000,
25 tco_num_remote_workers: 0,
26 so_remote_version_specifier: None,
27 so_remote_worker_vfs_checkout_threshold: 0,
28 so_naming_sqlite_path: None,
29 po_auto_namespace_map: &[],
31 po_deregister_php_stdlib: false,
32 po_disallow_toplevel_requires: false,
33 po_disable_nontoplevel_declarations: false,
34 po_disable_static_closures: true,
35 po_allow_unstable_features: false,
36 tco_log_inference_constraints: false,
37 tco_disallow_array_typehint: false,
38 tco_disallow_array_literal: false,
39 tco_language_feature_logging: false,
41 tco_disallow_scrutinee_case_value_type_mismatch: false,
43 tco_disallow_invalid_arraykey: false,
44 tco_disallow_byref_dynamic_calls: false,
45 tco_disallow_byref_calls: true,
46 allowed_fixme_codes_strict: i_set::ISet::empty(),
47 allowed_fixme_codes_partial: i_set::ISet::empty(),
48 codes_not_raised_partial: i_set::ISet::empty(),
49 log_levels: s_map::SMap::empty(),
50 po_disable_lval_as_an_expression: false,
51 tco_shallow_class_decl: false,
52 po_rust_parser_errors: false,
53 profile_type_check_duration_threshold: 0.0,
54 profile_type_check_twice: false,
57 tco_like_type_hints: false,
58 tco_union_intersection_type_hints: false,
60 tco_coeffects_local: true,
61 tco_strict_contexts: true,
62 tco_like_casts: false,
63 tco_simple_pessimize: 0.0,
64 tco_complex_coercion: false,
65 tco_disable_partially_abstract_typeconsts: false,
66 error_codes_treated_strictly: i_set::ISet::empty(),
67 tco_check_xhp_attribute: false,
68 tco_check_redundant_generics: false,
69 tco_disallow_unresolved_type_variables: false,
70 tco_disallow_trait_reuse: false,
71 tco_disallow_invalid_arraykey_constraint: false,
72 po_enable_class_level_where_clauses: false,
73 po_disable_legacy_soft_typehints: true,
74 po_allowed_decl_fixme_codes: i_set::ISet::empty(),
75 po_allow_new_attribute_syntax: false,
76 tco_global_inference: false,
77 tco_gi_reinfer_types: &[],
78 tco_ordered_solving: false,
79 tco_const_static_props: false,
80 po_disable_legacy_attribute_syntax: false,
81 tco_const_attribute: false,
82 po_const_default_func_args: false,
83 po_const_default_lambda_args: false,
84 po_disallow_silence: false,
85 po_abstract_static_props: false,
86 po_disable_unset_class_const: false,
87 po_parser_errors_only: false,
88 tco_check_attribute_locations: true,
89 po_disallow_func_ptrs_in_constants: false,
90 tco_error_php_lambdas: false,
91 tco_disallow_discarded_nullable_awaitables: false,
92 po_enable_xhp_class_modifier: false,
93 po_disable_xhp_element_mangling: false,
94 po_disable_xhp_children_declarations: false,
99 symbol_write_root_path: "",
100 symbol_write_hhi_path: "",
101 symbol_write_ignore_paths: &[],
102 symbol_write_index_paths: &[],
103 symbol_write_include_hhi: true,
104 po_enable_enum_classes: false,
105 po_disable_modes: false,
106 po_disable_hh_ignore_error: false,
107 po_disable_array: false,
108 po_disable_array_typehint: false,
109 tco_enable_systemlib_annotations: false,
110 tco_higher_kinded_types: false,
111 tco_method_call_inference: false,
112 tco_report_pos_from_reason: false,
113 tco_typecheck_sample_rate: 1.0,
114 tco_enable_sound_dynamic: false,
115 po_disallow_hash_comments: false,
116 po_disallow_fun_and_cls_meth_pseudo_funcs: false,
117 tco_use_direct_decl_parser: false,
118 tco_ifc_enabled: &[],
119 po_enable_enum_supertyping: false,
120 po_array_unification: false,
123 impl GlobalOptions<'static> {
124 pub const fn default_ref() -> &'static Self {
129 impl Default for &GlobalOptions<'_> {
130 fn default() -> Self {
131 GlobalOptions::default_ref()
135 impl Eq for GlobalOptions<'_> {}
137 impl std::hash::Hash for GlobalOptions<'_> {
138 fn hash<H>(&self, _: &mut H) {
143 impl no_pos_hash::NoPosHash for GlobalOptions<'_> {
144 fn hash<H>(&self, _: &mut H) {
149 impl Ord for GlobalOptions<'_> {
150 fn cmp(&self, _: &Self) -> std::cmp::Ordering {