Skip to content

Commit

Permalink
Back out "[flow] Remove the ability to configure type_expansion_recur…
Browse files Browse the repository at this point in the history
…sion_limit"

Summary:
Original commit changeset: 1e52900a1037

Original Phabricator Diff: D65785685

Changelog: [internal]

Reviewed By: gkz

Differential Revision: D66331719

fbshipit-source-id: 75046ea3895e673f4a2ceb0a94fda0c27e6e11de
  • Loading branch information
panagosg7 authored and facebook-github-bot committed Nov 22, 2024
1 parent 486347b commit 5af8c4d
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/commands/commandUtils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,7 @@ let make_options
~f:(Files.expand_project_root_token ~root)
(FlowConfig.strict_es6_import_export_excludes flowconfig);
opt_ts_syntax = FlowConfig.ts_syntax flowconfig;
opt_type_expansion_recursion_limit = FlowConfig.type_expansion_recursion_limit flowconfig;
opt_automatic_require_default =
Base.Option.value (FlowConfig.automatic_require_default flowconfig) ~default:false;
opt_format;
Expand Down
7 changes: 7 additions & 0 deletions src/commands/config/flowConfig.ml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ module Opts = struct
strict_es6_import_export_excludes: string list;
suppress_types: SSet.t;
ts_syntax: bool;
type_expansion_recursion_limit: int;
use_mixed_in_catch_variables: bool option;
ban_spread_key_props: bool option;
wait_for_recheck: bool;
Expand Down Expand Up @@ -276,6 +277,7 @@ module Opts = struct
strict_es6_import_export_excludes = [];
suppress_types = SSet.empty |> SSet.add "$FlowFixMe";
ts_syntax = false;
type_expansion_recursion_limit = 3;
use_mixed_in_catch_variables = None;
ban_spread_key_props = None;
wait_for_recheck = false;
Expand Down Expand Up @@ -1150,6 +1152,9 @@ module Opts = struct
("sharedmemory.hash_table_pow", shm_hash_table_pow_parser);
("sharedmemory.heap_size", uint (fun opts shm_heap_size -> Ok { opts with shm_heap_size }));
("suppress_type", suppress_types_parser);
( "experimental.type_expansion_recursion_limit",
uint (fun opts v -> Ok { opts with type_expansion_recursion_limit = v })
);
("types_first.max_files_checked_per_worker", max_files_checked_per_worker_parser);
("types_first.max_seconds_for_check_per_worker", max_seconds_for_check_per_worker_parser);
("use_mixed_in_catch_variables", use_mixed_in_catch_variables_parser);
Expand Down Expand Up @@ -1894,6 +1899,8 @@ let suppress_types c = c.options.Opts.suppress_types

let ts_syntax c = c.options.Opts.ts_syntax

let type_expansion_recursion_limit c = c.options.Opts.type_expansion_recursion_limit

let use_mixed_in_catch_variables c = c.options.Opts.use_mixed_in_catch_variables

let ban_spread_key_props c = c.options.Opts.ban_spread_key_props
Expand Down
2 changes: 2 additions & 0 deletions src/commands/config/flowConfig.mli
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ val suppress_types : config -> SSet.t

val ts_syntax : config -> bool

val type_expansion_recursion_limit : config -> int

val use_mixed_in_catch_variables : config -> bool option

val ban_spread_key_props : config -> bool option
Expand Down
3 changes: 3 additions & 0 deletions src/common/options.ml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ type t = {
opt_suppress_types: SSet.t;
opt_temp_dir: string;
opt_ts_syntax: bool;
opt_type_expansion_recursion_limit: int;
opt_use_mixed_in_catch_variables: bool;
opt_ban_spread_key_props: bool;
opt_verbose: Verbose.t option;
Expand Down Expand Up @@ -371,6 +372,8 @@ let temp_dir opts = opts.opt_temp_dir

let ts_syntax opts = opts.opt_ts_syntax

let type_expansion_recursion_limit opts = opts.opt_type_expansion_recursion_limit

let use_mixed_in_catch_variables opts = opts.opt_use_mixed_in_catch_variables

let ban_spread_key_props opts = opts.opt_ban_spread_key_props
Expand Down
1 change: 1 addition & 0 deletions src/flow_dot_js.ml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ let stub_metadata ~root ~checked =
strip_root = true;
suppress_types = SSet.of_list ["$FlowFixMe"; "$FlowIssue"; "$FlowIgnore"; "$FlowExpectedError"];
ts_syntax = true;
type_expansion_recursion_limit = 3;
use_mixed_in_catch_variables = false;
ban_spread_key_props = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ let stub_metadata ~root ~checked =
strip_root = true;
suppress_types = SSet.empty;
ts_syntax = true;
type_expansion_recursion_limit = 3;
use_mixed_in_catch_variables = false;
ban_spread_key_props = false;
}
Expand Down
1 change: 1 addition & 0 deletions src/typing/__tests__/type_hint_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ let metadata =
strip_root = true;
suppress_types = SSet.empty;
ts_syntax = true;
type_expansion_recursion_limit = 3;
use_mixed_in_catch_variables = false;
ban_spread_key_props = false;
}
Expand Down
1 change: 1 addition & 0 deletions src/typing/__tests__/typed_ast_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ let metadata =
strip_root = true;
suppress_types = SSet.empty;
ts_syntax = true;
type_expansion_recursion_limit = 3;
use_mixed_in_catch_variables = false;
ban_spread_key_props = false;
}
Expand Down
6 changes: 3 additions & 3 deletions src/typing/context.ml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ type metadata = {
strip_root: bool;
suppress_types: SSet.t;
ts_syntax: bool;
type_expansion_recursion_limit: int;
use_mixed_in_catch_variables: bool;
ban_spread_key_props: bool;
}
Expand Down Expand Up @@ -234,7 +235,6 @@ type t = {
resolve_require: resolve_require;
hint_map_arglist_cache: (ALoc.t * Type.call_arg) list ALocMap.t ref;
hint_map_jsx_cache: (Reason.t * string * ALoc.t list * ALoc.t, Type.t Lazy.t) Hashtbl.t;
type_expansion_recursion_limit: int;
mutable hint_eval_cache: Type.t option IMap.t;
mutable environment: Loc_env.t;
mutable typing_mode: typing_mode;
Expand Down Expand Up @@ -305,6 +305,7 @@ let metadata_of_options options =
strip_root = Options.should_strip_root options;
suppress_types = Options.suppress_types options;
ts_syntax = Options.ts_syntax options;
type_expansion_recursion_limit = Options.type_expansion_recursion_limit options;
use_mixed_in_catch_variables = Options.use_mixed_in_catch_variables options;
ban_spread_key_props = Options.ban_spread_key_props options;
}
Expand Down Expand Up @@ -431,7 +432,6 @@ let make ccx metadata file aloc_table resolve_require mk_builtins =
hint_map_arglist_cache = ref ALocMap.empty;
hint_map_jsx_cache = Hashtbl.create 0;
hint_eval_cache = IMap.empty;
type_expansion_recursion_limit = 3;
environment = Loc_env.empty Name_def.Global;
typing_mode = CheckingMode;
reachable_deps = Utils_js.FilenameSet.empty;
Expand Down Expand Up @@ -602,7 +602,7 @@ let suppress_types cx = cx.metadata.suppress_types

let ts_syntax cx = cx.metadata.ts_syntax

let type_expansion_recursion_limit cx = cx.type_expansion_recursion_limit
let type_expansion_recursion_limit cx = cx.metadata.type_expansion_recursion_limit

let literal_subtypes cx = cx.ccx.literal_subtypes

Expand Down
1 change: 1 addition & 0 deletions src/typing/context.mli
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ type metadata = {
strip_root: bool;
suppress_types: SSet.t;
ts_syntax: bool;
type_expansion_recursion_limit: int;
use_mixed_in_catch_variables: bool;
ban_spread_key_props: bool;
}
Expand Down

0 comments on commit 5af8c4d

Please sign in to comment.