Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename effect to effect_ as it is a reserver keyword in OCaml 5.3 #9268

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/analysis/env_builder/find_providers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ end = struct
tparams;
async = _;
generator = _;
effect = _;
effect_ = _;
sig_loc = _;
comments = _;
} =
Expand Down Expand Up @@ -881,7 +881,7 @@ end = struct
tparams;
async = _;
generator = _;
effect = _;
effect_ = _;
sig_loc = _;
comments = _;
} =
Expand Down Expand Up @@ -921,7 +921,7 @@ end = struct
tparams;
async = _;
generator = _;
effect = _;
effect_ = _;
sig_loc = _;
comments = _;
} =
Expand Down
14 changes: 7 additions & 7 deletions src/analysis/env_builder/name_def.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ class def_finder ~autocomplete_hooks ~react_jsx env_info toplevel_scope =

method! function_param (loc, _) = fail loc "Should be visited by visit_function_param"

method private visit_function_param ~hints ~effect (param : ('loc, 'loc) Ast.Function.Param.t) =
method private visit_function_param ~hints ~effect_ (param : ('loc, 'loc) Ast.Function.Param.t) =
let open Ast.Function.Param in
let (loc, { argument; default = default_expression }) = param in
let optional =
Expand All @@ -1161,7 +1161,7 @@ class def_finder ~autocomplete_hooks ~react_jsx env_info toplevel_scope =
optional;
has_default_expression = Base.Option.is_some default_expression;
react_deep_read_only =
( if effect = Ast.Function.Hook then
( if effect_ = Ast.Function.Hook then
Some Hook
else
None
Expand Down Expand Up @@ -1215,7 +1215,7 @@ class def_finder ~autocomplete_hooks ~react_jsx env_info toplevel_scope =
ignore @@ super#function_param (loc, { argument; default = None })

method private visit_function_rest_param
~hints ~effect (expr : ('loc, 'loc) Ast.Function.RestParam.t) =
~hints ~effect_ (expr : ('loc, 'loc) Ast.Function.RestParam.t) =
let open Ast.Function.RestParam in
let (_, { argument; comments = _ }) = expr in
let (param_loc, _) = argument in
Expand All @@ -1228,7 +1228,7 @@ class def_finder ~autocomplete_hooks ~react_jsx env_info toplevel_scope =
optional = false;
has_default_expression = false;
react_deep_read_only =
( if effect = Ast.Function.Hook then
( if effect_ = Ast.Function.Hook then
Some Hook
else
None
Expand Down Expand Up @@ -1694,7 +1694,7 @@ class def_finder ~autocomplete_hooks ~react_jsx env_info toplevel_scope =
body;
async;
generator;
effect;
effect_;
predicate;
return;
tparams = fun_tparams;
Expand All @@ -1710,13 +1710,13 @@ class def_finder ~autocomplete_hooks ~react_jsx env_info toplevel_scope =
Base.List.iteri
~f:(fun i ->
this#visit_function_param
~effect
~effect_
~hints:(decompose_hints (Decomp_FuncParam (param_str_list, i, pred)) func_hints))
params_list;
Base.Option.iter
~f:
(this#visit_function_rest_param
~effect
~effect_
~hints:(decompose_hints (Decomp_FuncRest (param_str_list, pred)) func_hints)
)
rest;
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/property_assignment.ml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ let eval_property_assignment class_body =
params = _;
async = _;
generator = _;
effect = _;
effect_ = _;
predicate = _;
return = _;
tparams = _;
Expand Down
6 changes: 3 additions & 3 deletions src/analysis/scope_builder.ml
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ module Make (L : Loc_sig.S) (Api : Scope_api_sig.S with module L = L) :
tparams;
async = _;
generator;
effect = _;
effect_ = _;
predicate;
sig_loc = _;
comments = _;
Expand Down Expand Up @@ -840,7 +840,7 @@ module Make (L : Loc_sig.S) (Api : Scope_api_sig.S with module L = L) :
tparams;
async = _;
generator;
effect = _;
effect_ = _;
predicate;
sig_loc = _;
comments = _;
Expand Down Expand Up @@ -906,7 +906,7 @@ module Make (L : Loc_sig.S) (Api : Scope_api_sig.S with module L = L) :
params = (_, { Params.this_; params = ps; rest = rpo; comments = _ });
return;
tparams;
effect = _;
effect_ = _;
comments = _;
} =
ft
Expand Down
4 changes: 2 additions & 2 deletions src/common/ty/ty_serializer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,14 @@ let type_ options =
let return = fun_return_t f.fun_return in
let params = fun_params f.fun_params f.fun_rest_param in
let tparams = Base.Option.map ~f:type_params f.fun_type_params in
let effect =
let effect_ =
match f.fun_effect with
| Ty.Arbitrary -> Ast.Function.Arbitrary
| Ty.Hook -> Ast.Function.Hook
| Ty.Parametric n -> Ast.Function.Parametric n
| Ty.Idempotent -> Ast.Function.Idempotent
in
{ T.Function.params; return; tparams; effect; comments = None }
{ T.Function.params; return; tparams; effect_; comments = None }
and fun_params params rest_param =
let params = Base.List.map ~f:fun_param params in
let rest = Base.Option.map ~f:fun_rest_param rest_param in
Expand Down
8 changes: 4 additions & 4 deletions src/parser/declaration_parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,11 @@ module Declaration (Parse : Parser_common.PARSER) (Type : Parser_common.TYPE) :
let _function =
with_loc (fun env ->
let (async, leading_async) = async env in
let (sig_loc, (generator, effect, tparams, id, params, return, predicate, leading)) =
let (sig_loc, (generator, effect_, tparams, id, params, return, predicate, leading)) =
with_loc
(fun env ->
let leading_function = Peek.comments env in
let (effect, (generator, leading_generator)) =
let (effect_, (generator, leading_generator)) =
match Peek.token env with
| T_FUNCTION ->
Eat.token env;
Expand Down Expand Up @@ -372,7 +372,7 @@ module Declaration (Parse : Parser_common.PARSER) (Type : Parser_common.TYPE) :
| None -> (return_annotation_remove_trailing env return, predicate)
| Some _ -> (return, predicate_remove_trailing env predicate)
in
(generator, effect, tparams, id, params, return, predicate, leading))
(generator, effect_, tparams, id, params, return, predicate, leading))
env
in
let simple_params = is_simple_parameter_list params in
Expand All @@ -386,7 +386,7 @@ module Declaration (Parse : Parser_common.PARSER) (Type : Parser_common.TYPE) :
params;
body;
generator;
effect;
effect_;
async;
predicate;
return;
Expand Down
16 changes: 8 additions & 8 deletions src/parser/estree_translator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ with type t = Impl.t = struct
{
Function.params = (_, { Function.Params.comments = params_comments; _ }) as params;
async;
effect = _;
effect_ = _;
predicate = predicate_;
tparams;
return;
Expand Down Expand Up @@ -804,7 +804,7 @@ with type t = Impl.t = struct
params = (_, { Function.Params.comments = params_comments; _ }) as params;
async;
generator;
effect;
effect_;
predicate = predicate_;
tparams;
return;
Expand All @@ -824,7 +824,7 @@ with type t = Impl.t = struct
~inner:(format_internal_comments params_comments)
in
let (node_name, nonhook_attrs) =
if effect = Function.Hook then
if effect_ = Function.Hook then
("HookDeclaration", [])
else
( "FunctionDeclaration",
Expand Down Expand Up @@ -859,7 +859,7 @@ with type t = Impl.t = struct
params = (_, { Function.Params.comments = params_comments; _ }) as params;
async;
generator;
effect = _;
effect_ = _;
predicate = predicate_;
tparams;
return;
Expand Down Expand Up @@ -954,7 +954,7 @@ with type t = Impl.t = struct
let id_loc = Loc.btwn (fst id) (fst annot) in
let (name, predicate) =
match annot with
| (_, (_, Type.Function { Type.Function.effect = Function.Hook; _ })) -> ("DeclareHook", [])
| (_, (_, Type.Function { Type.Function.effect_ = Function.Hook; _ })) -> ("DeclareHook", [])
| _ -> ("DeclareFunction", [("predicate", option predicate predicate_)])
in
node
Expand Down Expand Up @@ -1807,7 +1807,7 @@ with type t = Impl.t = struct
(_, { Type.Function.Params.this_; params; rest; comments = params_comments });
return;
tparams;
effect;
effect_;
comments = func_comments;
}
) =
Expand All @@ -1817,7 +1817,7 @@ with type t = Impl.t = struct
~outer:func_comments
in
let name =
if effect = Function.Hook then
if effect_ = Function.Hook then
"HookTypeAnnotation"
else
"FunctionTypeAnnotation"
Expand All @@ -1833,7 +1833,7 @@ with type t = Impl.t = struct
("typeParameters", option type_parameter_declaration tparams);
]
@
if effect = Function.Hook then
if effect_ = Function.Hook then
[]
else
[("this", option function_type_this_constraint this_)]
Expand Down
4 changes: 2 additions & 2 deletions src/parser/expression_parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ module Expression
params;
body;
generator;
effect = Function.Arbitrary;
effect_ = Function.Arbitrary;
async;
predicate;
return;
Expand Down Expand Up @@ -1875,7 +1875,7 @@ module Expression
async;
generator = false;
(* arrow functions cannot be generators *)
effect = Function.Arbitrary;
effect_ = Function.Arbitrary;
predicate;
return;
tparams;
Expand Down
6 changes: 3 additions & 3 deletions src/parser/flow_ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ and Type : sig
params: ('M, 'T) Params.t;
return: ('M, 'T) return_annotation;
comments: ('M, unit) Syntax.t option;
effect: Function.effect;
effect_: Function.effect_;
}

and ('M, 'T) return_annotation =
Expand Down Expand Up @@ -2377,7 +2377,7 @@ and Function : sig
[@@deriving show]
end

type effect =
type effect_ =
| Hook
| Arbitrary
| Idempotent
Expand All @@ -2390,7 +2390,7 @@ and Function : sig
body: ('M, 'T) body;
async: bool;
generator: bool;
effect: effect;
effect_: effect_;
predicate: ('M, 'T) Type.Predicate.t option;
return: ('M, 'T) ReturnAnnot.t;
tparams: ('M, 'T) Type.TypeParams.t option;
Expand Down
8 changes: 4 additions & 4 deletions src/parser/flow_ast_mapper.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,7 @@ class ['loc] mapper =
return;
tparams;
comments = func_comments;
effect;
effect_;
} =
ft
in
Expand Down Expand Up @@ -1387,7 +1387,7 @@ class ['loc] mapper =
return = return';
tparams = tparams';
comments = func_comments';
effect;
effect_;
}

method label_identifier (ident : ('loc, 'loc) Ast.Identifier.t) = this#identifier ident
Expand Down Expand Up @@ -1982,7 +1982,7 @@ class ['loc] mapper =
body;
async;
generator;
effect;
effect_;
predicate;
return;
tparams;
Expand Down Expand Up @@ -2016,7 +2016,7 @@ class ['loc] mapper =
body = body';
async;
generator;
effect;
effect_;
predicate = predicate';
tparams = tparams';
sig_loc;
Expand Down
6 changes: 3 additions & 3 deletions src/parser/object_parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ module Object
body;
generator;
async;
effect = Function.Arbitrary;
effect_ = Function.Arbitrary;
predicate = None;
(* setters/getter are not predicates *)
return;
Expand Down Expand Up @@ -274,7 +274,7 @@ module Object
params;
body;
generator;
effect = Function.Arbitrary;
effect_ = Function.Arbitrary;
async;
(* TODO: add support for object method predicates *)
predicate = None;
Expand Down Expand Up @@ -850,7 +850,7 @@ module Object
body;
generator;
async;
effect = Function.Arbitrary;
effect_ = Function.Arbitrary;
(* TODO: add support for method predicates *)
predicate = None;
return;
Expand Down
8 changes: 4 additions & 4 deletions src/parser/statement_parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ module Statement

and declare_function ~async ?(leading = []) env =
let leading = leading @ Peek.comments env in
let effect =
let effect_ =
match Peek.token env with
| T_FUNCTION ->
Eat.token env;
Expand All @@ -1232,18 +1232,18 @@ module Statement
Expect.token env T_COLON;
Eat.push_lex_mode env Lex_mode.TYPE;
let return =
if is_start_of_type_guard env && effect <> Function.Hook then
if is_start_of_type_guard env && effect_ <> Function.Hook then
Ast.Type.Function.TypeGuard (Type.type_guard env)
else
let return = Type._type env in
let has_predicate = Peek.token env = T_CHECKS in
if has_predicate && effect <> Function.Hook then
if has_predicate && effect_ <> Function.Hook then
Ast.Type.Function.TypeAnnotation (type_remove_trailing env return)
else
Ast.Type.Function.TypeAnnotation return
in
Eat.pop_lex_mode env;
Ast.Type.(Function { Function.params; return; tparams; comments = None; effect }))
Ast.Type.(Function { Function.params; return; tparams; comments = None; effect_ }))
env
in
let predicate = Type.predicate_opt env in
Expand Down
Loading
Loading