Skip to content

Commit a55be3b

Browse files
Chaoqiang Dengfacebook-github-bot
Chaoqiang Deng
authored andcommitted
Rename the argument --enable-global-access-check-files
Summary: Rename the argument from "`--enable-global-access-check`" to "`--enable-global-access-check-files`" (which turns on the checker for the files with the given prefix), such that it can be easily distinguish from another argument "`--enable-global-access-check-functions`" (which turns on the checker for the functions in the given json file) by the name. Reviewed By: jamesjwu, yuxuanchen1997 Differential Revision: D40035427 fbshipit-source-id: e8b262f069ef0e24869bd709cb4cb88f2a531317
1 parent be9b3ed commit a55be3b

17 files changed

+61
-54
lines changed

hphp/hack/src/hackrs/compare_folded_decls_file.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ let () =
242242
(* The following options do not affect the direct decl parser and can be ignored
243243
(they are used by hh_single_type_check, and we run hh_single_decl over all of
244244
the typecheck test cases). *)
245-
ignored_arg "--enable-global-access-check";
245+
ignored_arg "--enable-global-access-check-files";
246246
ignored_arg "--enable-global-access-check-functions";
247247
ignored_flag "--abstract-static-props";
248248
ignored_arg "--allowed-decl-fixme-codes";

hphp/hack/src/hh_oxidize/convert_toplevel_phrase.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ let enum_modules =
7575
("error_codes", "NastCheck");
7676
("error_codes", "Typing");
7777
("error_codes", "Init");
78-
(* An optional error set that runs only for arg --enable-global-access-check
79-
or --enable-global-access-check-function. *)
78+
(* An optional error set that runs only for arg --enable-global-access-check-files
79+
or --enable-global-access-check-functions. *)
8080
("error_codes", "GlobalWriteCheck");
8181
]
8282

hphp/hack/src/hh_single_decl.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ let () =
241241
(* The following options do not affect the direct decl parser and can be ignored
242242
(they are used by hh_single_type_check, and we run hh_single_decl over all of
243243
the typecheck test cases). *)
244-
ignored_arg "--enable-global-access-check";
244+
ignored_arg "--enable-global-access-check-files";
245245
ignored_arg "--enable-global-access-check-functions";
246246
ignored_flag "--abstract-static-props";
247247
ignored_arg "--allowed-decl-fixme-codes";

hphp/hack/src/hh_single_type_check.ml

+7-6
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ let parse_options () =
328328
ref (TypecheckerOptions.profile_top_level_definitions GlobalOptions.default)
329329
in
330330
let memtrace = ref None in
331-
let enable_global_access_check = ref [] in
331+
let enable_global_access_check_files = ref [] in
332332
let enable_global_access_check_functions = ref SSet.empty in
333333
let refactor_mode = ref "" in
334334
let refactor_analysis_mode = ref "" in
@@ -814,14 +814,15 @@ let parse_options () =
814814
" Sets the amount of fuel that the type printer can use to display an individual type. Default: "
815815
^ string_of_int
816816
(TypecheckerOptions.type_printer_fuel GlobalOptions.default) );
817-
( "--enable-global-access-check",
817+
( "--enable-global-access-check-files",
818818
Arg.String
819-
(fun s -> enable_global_access_check := String_utils.split ',' s),
820-
" Run global write checker on any file whose path is prefixed by the argument (use \"\\\" for hh_single_type_check)"
819+
(fun s ->
820+
enable_global_access_check_files := String_utils.split ',' s),
821+
" Run global access checker on any file whose path is prefixed by the argument (use \"\\\" for hh_single_type_check)"
821822
);
822823
( "--enable-global-access-check-functions",
823824
Arg.String set_enable_global_access_check_functions,
824-
" Run global write checker on functions listed in the given JSON file"
825+
" Run global access checker on functions listed in the given JSON file"
825826
);
826827
( "--overwrite-loop-iteration-upper-bound",
827828
Arg.Int (fun u -> loop_iteration_upper_bound := Some u),
@@ -965,7 +966,7 @@ let parse_options () =
965966
["/"]
966967
else
967968
[])
968-
~tco_global_access_check_enabled:!enable_global_access_check
969+
~tco_global_access_check_files_enabled:!enable_global_access_check_files
969970
~tco_global_access_check_functions_enabled:
970971
!enable_global_access_check_functions
971972
~tco_use_direct_decl_parser:!use_direct_decl_parser

hphp/hack/src/options/globalOptions.ml

+5-4
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ type t = {
128128
po_disallow_inst_meth: bool;
129129
tco_use_direct_decl_parser: bool;
130130
tco_ifc_enabled: string list;
131-
tco_global_access_check_enabled: string list;
131+
tco_global_access_check_files_enabled: string list;
132132
tco_global_access_check_functions_enabled: SSet.t;
133133
po_enable_enum_supertyping: bool;
134134
po_interpret_soft_types_as_like_types: bool;
@@ -268,7 +268,7 @@ let default =
268268
po_disallow_inst_meth = false;
269269
tco_use_direct_decl_parser = true;
270270
tco_ifc_enabled = [];
271-
tco_global_access_check_enabled = [];
271+
tco_global_access_check_files_enabled = [];
272272
tco_global_access_check_functions_enabled = SSet.empty;
273273
po_enable_enum_supertyping = true;
274274
po_interpret_soft_types_as_like_types = false;
@@ -419,7 +419,8 @@ let make
419419
?(po_disallow_inst_meth = default.po_disallow_inst_meth)
420420
?(tco_use_direct_decl_parser = default.tco_use_direct_decl_parser)
421421
?(tco_ifc_enabled = default.tco_ifc_enabled)
422-
?(tco_global_access_check_enabled = default.tco_global_access_check_enabled)
422+
?(tco_global_access_check_files_enabled =
423+
default.tco_global_access_check_files_enabled)
423424
?(tco_global_access_check_functions_enabled =
424425
default.tco_global_access_check_functions_enabled)
425426
?(po_enable_enum_supertyping = default.po_enable_enum_supertyping)
@@ -572,7 +573,7 @@ let make
572573
po_disallow_inst_meth;
573574
tco_use_direct_decl_parser;
574575
tco_ifc_enabled;
575-
tco_global_access_check_enabled;
576+
tco_global_access_check_files_enabled;
576577
tco_global_access_check_functions_enabled;
577578
po_enable_enum_supertyping;
578579
po_interpret_soft_types_as_like_types;

hphp/hack/src/options/globalOptions.mli

+4-4
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,11 @@ type t = {
257257
(a list containing the empty string would denote all files,
258258
an empty list denotes no files) *)
259259
tco_ifc_enabled: string list;
260-
(* Enable global write check on the specified list of path prefixes
260+
(* Enable global access check on the specified list of path prefixes
261261
(a list containing the empty string would denote all files,
262262
an empty list denotes no files) *)
263-
tco_global_access_check_enabled: string list;
264-
(* Enable global write check on the spcified set of functions
263+
tco_global_access_check_files_enabled: string list;
264+
(* Enable global access check on the spcified set of functions
265265
(Empty denotes no functions) *)
266266
tco_global_access_check_functions_enabled: SSet.t;
267267
(* Enables the enum supertyping extension *)
@@ -439,7 +439,7 @@ val make :
439439
?po_disallow_inst_meth:bool ->
440440
?tco_use_direct_decl_parser:bool ->
441441
?tco_ifc_enabled:string list ->
442-
?tco_global_access_check_enabled:string list ->
442+
?tco_global_access_check_files_enabled:string list ->
443443
?tco_global_access_check_functions_enabled:SSet.t ->
444444
?po_enable_enum_supertyping:bool ->
445445
?po_interpret_soft_types_as_like_types:bool ->

hphp/hack/src/options/typecheckerOptions.ml

+4-4
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ let enable_ifc t = GlobalOptions.{ t with tco_ifc_enabled = ["/"] }
155155

156156
let ifc_enabled t = t.GlobalOptions.tco_ifc_enabled
157157

158-
let enable_global_access_check t =
159-
GlobalOptions.{ t with tco_global_access_check_enabled = ["/"] }
158+
let enable_global_access_check_files t =
159+
GlobalOptions.{ t with tco_global_access_check_files_enabled = ["/"] }
160160

161-
let global_access_check_enabled t =
162-
t.GlobalOptions.tco_global_access_check_enabled
161+
let global_access_check_files_enabled t =
162+
t.GlobalOptions.tco_global_access_check_files_enabled
163163

164164
let global_access_check_functions_enabled t =
165165
t.GlobalOptions.tco_global_access_check_functions_enabled

hphp/hack/src/oxidized/gen/global_options.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// This source code is licensed under the MIT license found in the
44
// LICENSE file in the "hack" directory of this source tree.
55
//
6-
// @generated SignedSource<<618c9c7aba2f3189646de21f775d6491>>
6+
// @generated SignedSource<<d412f7aa311a71c04d8bef01eee2b491>>
77
//
88
// To regenerate this file, run:
99
// hphp/hack/src/oxidized_regen.sh
@@ -133,7 +133,7 @@ pub struct GlobalOptions {
133133
pub po_disallow_inst_meth: bool,
134134
pub tco_use_direct_decl_parser: bool,
135135
pub tco_ifc_enabled: Vec<String>,
136-
pub tco_global_access_check_enabled: Vec<String>,
136+
pub tco_global_access_check_files_enabled: Vec<String>,
137137
pub tco_global_access_check_functions_enabled: s_set::SSet,
138138
pub po_enable_enum_supertyping: bool,
139139
pub po_interpret_soft_types_as_like_types: bool,

hphp/hack/src/oxidized/manual/global_options_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl Default for GlobalOptions {
111111
po_disallow_inst_meth: false,
112112
tco_use_direct_decl_parser: true,
113113
tco_ifc_enabled: vec![],
114-
tco_global_access_check_enabled: vec![],
114+
tco_global_access_check_files_enabled: vec![],
115115
tco_global_access_check_functions_enabled: s_set::SSet::new(),
116116
po_enable_enum_supertyping: true,
117117
po_interpret_soft_types_as_like_types: false,

hphp/hack/src/oxidized_by_ref/gen/global_options.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// This source code is licensed under the MIT license found in the
44
// LICENSE file in the "hack" directory of this source tree.
55
//
6-
// @generated SignedSource<<7f2e8a77347250323dcd3eecaca58989>>
6+
// @generated SignedSource<<37e03868880ffb01ac0fe62911b0bb79>>
77
//
88
// To regenerate this file, run:
99
// hphp/hack/src/oxidized_regen.sh
@@ -158,7 +158,7 @@ pub struct GlobalOptions<'a> {
158158
#[serde(deserialize_with = "arena_deserializer::arena", borrow)]
159159
pub tco_ifc_enabled: &'a [&'a str],
160160
#[serde(deserialize_with = "arena_deserializer::arena", borrow)]
161-
pub tco_global_access_check_enabled: &'a [&'a str],
161+
pub tco_global_access_check_files_enabled: &'a [&'a str],
162162
#[serde(deserialize_with = "arena_deserializer::arena", borrow)]
163163
pub tco_global_access_check_functions_enabled: s_set::SSet<'a>,
164164
pub po_enable_enum_supertyping: bool,

hphp/hack/src/oxidized_by_ref/manual/global_options_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const DEFAULT: GlobalOptions<'_> = GlobalOptions {
109109
po_disallow_inst_meth: false,
110110
tco_use_direct_decl_parser: true,
111111
tco_ifc_enabled: &[],
112-
tco_global_access_check_enabled: &[],
112+
tco_global_access_check_files_enabled: &[],
113113
tco_global_access_check_functions_enabled: s_set::SSet::empty(),
114114
po_enable_enum_supertyping: true,
115115
po_interpret_soft_types_as_like_types: false,

hphp/hack/src/server/serverArgs.ml

+21-18
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type options = {
2828
gen_saved_ignore_type_errors: bool;
2929
ignore_hh_version: bool;
3030
enable_ifc: string list;
31-
enable_global_access_check: string list;
31+
enable_global_access_check_files: string list;
3232
enable_global_access_check_functions: SSet.t;
3333
saved_state_ignore_hhconfig: bool;
3434
json_mode: bool;
@@ -78,11 +78,11 @@ module Messages = struct
7878
let enable_ifc =
7979
" run IFC analysis on any file whose path is prefixed by the argument (format: comma separated list of path prefixes)"
8080

81-
let enable_global_access_check =
82-
" run global write checker on any file whose path is prefixed by the argument (format: comma separated list of path prefixes)"
81+
let enable_global_access_check_files =
82+
" run global access checker on any file whose path is prefixed by the argument (format: comma separated list of path prefixes)"
8383

8484
let enable_global_access_check_functions =
85-
" run global write checker on functions listed in the JSON file"
85+
" run global access checker on functions listed in the JSON file"
8686

8787
let from = " so we know who's invoking - e.g. nuclide, vim, emacs, vscode"
8888

@@ -159,7 +159,7 @@ let parse_options () : options =
159159
let custom_telemetry_data = ref [] in
160160
let dump_fanout = ref false in
161161
let enable_ifc = ref [] in
162-
let enable_global_access_check = ref [] in
162+
let enable_global_access_check_files = ref [] in
163163
let enable_global_access_check_functions = ref SSet.empty in
164164
let from = ref "" in
165165
let from_emacs = ref false in
@@ -195,8 +195,8 @@ let parse_options () : options =
195195
let set_with_saved_state s = with_saved_state := Some s in
196196
let set_write_symbol_info s = write_symbol_info := Some s in
197197
let set_enable_ifc s = enable_ifc := String_utils.split ',' s in
198-
let set_enable_global_access_check s =
199-
enable_global_access_check := String_utils.split ',' s
198+
let set_enable_global_access_check_files s =
199+
enable_global_access_check_files := String_utils.split ',' s
200200
in
201201
let set_enable_global_access_check_functions s =
202202
let json_obj = Hh_json.json_of_file s in
@@ -236,9 +236,9 @@ let parse_options () : options =
236236
("--daemon", Arg.Set should_detach, Messages.daemon);
237237
("--dump-fanout", Arg.Set dump_fanout, Messages.dump_fanout);
238238
("--enable-ifc", Arg.String set_enable_ifc, Messages.enable_ifc);
239-
( "--enable-global-access-check",
240-
Arg.String set_enable_global_access_check,
241-
Messages.enable_global_access_check );
239+
( "--enable-global-access-check-files",
240+
Arg.String set_enable_global_access_check_files,
241+
Messages.enable_global_access_check_files );
242242
( "--enable-global-access-check-functions",
243243
Arg.String set_enable_global_access_check_functions,
244244
Messages.enable_global_access_check_functions );
@@ -355,7 +355,7 @@ let parse_options () : options =
355355
custom_telemetry_data = !custom_telemetry_data;
356356
dump_fanout = !dump_fanout;
357357
enable_ifc = !enable_ifc;
358-
enable_global_access_check = !enable_global_access_check;
358+
enable_global_access_check_files = !enable_global_access_check_files;
359359
enable_global_access_check_functions = !enable_global_access_check_functions;
360360
from = !from;
361361
gen_saved_ignore_type_errors = !gen_saved_ignore_type_errors;
@@ -391,7 +391,7 @@ let default_options ~root =
391391
custom_telemetry_data = [];
392392
dump_fanout = false;
393393
enable_ifc = [];
394-
enable_global_access_check = [];
394+
enable_global_access_check_files = [];
395395
enable_global_access_check_functions = SSet.empty;
396396
from = "";
397397
gen_saved_ignore_type_errors = false;
@@ -441,7 +441,8 @@ let dump_fanout options = options.dump_fanout
441441

442442
let enable_ifc options = options.enable_ifc
443443

444-
let enable_global_access_check options = options.enable_global_access_check
444+
let enable_global_access_check_files options =
445+
options.enable_global_access_check_files
445446

446447
let enable_global_access_check_functions options =
447448
options.enable_global_access_check_functions
@@ -531,7 +532,7 @@ let to_string
531532
custom_telemetry_data;
532533
dump_fanout;
533534
enable_ifc;
534-
enable_global_access_check;
535+
enable_global_access_check_files;
535536
enable_global_access_check_functions;
536537
from;
537538
gen_saved_ignore_type_errors;
@@ -626,8 +627,10 @@ let to_string
626627
let enable_ifc_str =
627628
Printf.sprintf "[%s]" (String.concat ~sep:"," enable_ifc)
628629
in
629-
let enable_global_access_check_str =
630-
Printf.sprintf "[%s]" (String.concat ~sep:"," enable_global_access_check)
630+
let enable_global_access_check_files_str =
631+
Printf.sprintf
632+
"[%s]"
633+
(String.concat ~sep:"," enable_global_access_check_files)
631634
in
632635
let enable_global_access_check_functions_str =
633636
Printf.sprintf
@@ -663,8 +666,8 @@ let to_string
663666
"enable_ifc: ";
664667
enable_ifc_str;
665668
", ";
666-
"enable_global_access_check: ";
667-
enable_global_access_check_str;
669+
"enable_global_access_check_files: ";
670+
enable_global_access_check_files_str;
668671
", ";
669672
"enable_global_access_check_functions: ";
670673
enable_global_access_check_functions_str;

hphp/hack/src/server/serverArgs_sig.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module type S = sig
4848

4949
val enable_ifc : options -> string list
5050

51-
val enable_global_access_check : options -> string list
51+
val enable_global_access_check_files : options -> string list
5252

5353
val enable_global_access_check_functions : options -> SSet.t
5454

hphp/hack/src/server/serverConfig.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ let load ~silent config_filename options : t * ServerLocalConfig.t =
442442
~tco_use_direct_decl_parser:
443443
local_config.ServerLocalConfig.use_direct_decl_parser
444444
~tco_ifc_enabled:(ServerArgs.enable_ifc options)
445-
~tco_global_access_check_enabled:
446-
(ServerArgs.enable_global_access_check options)
445+
~tco_global_access_check_files_enabled:
446+
(ServerArgs.enable_global_access_check_files options)
447447
~tco_global_access_check_functions_enabled:
448448
(ServerArgs.enable_global_access_check_functions options)
449449
?po_enable_enum_classes:(bool_opt "enable_enum_classes" config)

hphp/hack/src/typing/tast_check/global_access_check.ml

+5-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
*
1414
* By default, this checker is turned off.
1515
* To turn on this checker:
16-
* - use the argument --enable-global-access-check
16+
* - use the argument --enable-global-access-check-files
1717
* to specify the prefixes of files to be checked (e.g. "/" for all files).
18-
* - use the argument --enable-global-access-check-function
18+
* - use the argument --enable-global-access-check-functions
1919
* to specify a JSON file of functions names to be checked.
2020
* Together with --config enable_type_check_filter_files=true, this option
2121
* checks specified functions within listed files.
@@ -539,7 +539,9 @@ let visitor =
539539
end
540540

541541
let global_access_check_enabled_on_file tcopt file =
542-
let enabled_paths = TypecheckerOptions.global_access_check_enabled tcopt in
542+
let enabled_paths =
543+
TypecheckerOptions.global_access_check_files_enabled tcopt
544+
in
543545
let path = "/" ^ Relative_path.suffix file in
544546
List.exists enabled_paths ~f:(fun prefix ->
545547
String_utils.string_starts_with path prefix)

hphp/hack/src/typing/tast_check/tast_check.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ let visitor ctx =
4242
let is_global_access_check_enabled =
4343
0
4444
<> List.length
45-
(TypecheckerOptions.global_access_check_enabled
45+
(TypecheckerOptions.global_access_check_files_enabled
4646
(Provider_context.get_tcopt ctx))
4747
|| 0
4848
<> SSet.cardinal
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
--enable-global-access-check "/"
1+
--enable-global-access-check-files "/"
22
--allowed-fixme-codes-strict 11001,11002,11003

0 commit comments

Comments
 (0)