@@ -1348,7 +1348,9 @@ class def_finder ~autocomplete_hooks ~react_jsx env_info toplevel_scope =
|
1348 | 1348 | } =
|
1349 | 1349 | stmt
|
1350 | 1350 | in
|
1351 |
| -Base.Option.iter component_tparams ~f:(fun tparams -> ignore @@ this#type_params tparams); |
| 1351 | +Base.Option.iter component_tparams ~f:(fun tparams -> |
| 1352 | +ignore @@ this#type_params ~kind:Flow_ast_mapper.ComponentDeclarationTP tparams |
| 1353 | +); |
1352 | 1354 | Base.List.iter ~f:this#visit_component_param params_list;
|
1353 | 1355 | Base.Option.iter ~f:this#visit_component_rest_param rest;
|
1354 | 1356 | ignore @@ this#component_renders_annotation renders;
|
@@ -1706,7 +1708,9 @@ class def_finder ~autocomplete_hooks ~react_jsx env_info toplevel_scope =
|
1706 | 1708 | } =
|
1707 | 1709 | expr
|
1708 | 1710 | in
|
1709 |
| -Base.Option.iter fun_tparams ~f:(fun tparams -> ignore @@ this#type_params tparams); |
| 1711 | +Base.Option.iter fun_tparams ~f:(fun tparams -> |
| 1712 | +ignore @@ (this#type_params ~kind:Flow_ast_mapper.FunctionTP) tparams |
| 1713 | +); |
1710 | 1714 | run_opt this#function_this_param this_;
|
1711 | 1715 | let param_str_list = this#params_list_to_str_opt params_list in
|
1712 | 1716 | let pred = this#hint_pred_kind params body return in
|
@@ -1799,7 +1803,7 @@ class def_finder ~autocomplete_hooks ~react_jsx env_info toplevel_scope =
|
1799 | 1803 | this#in_scope
|
1800 | 1804 | (fun () ->
|
1801 | 1805 | run_opt this#class_identifier id;
|
1802 |
| -run_opt this#type_params class_tparams; |
| 1806 | +run_opt (this#type_params ~kind:Flow_ast_mapper.ClassTP) class_tparams; |
1803 | 1807 | let this_tparam_loc = Base.Option.value_map ~default:loc ~f:fst id in
|
1804 | 1808 | this#add_tparam this_tparam_loc "this";
|
1805 | 1809 | ignore @@ this#class_body body;
|
@@ -2243,22 +2247,26 @@ class def_finder ~autocomplete_hooks ~react_jsx env_info toplevel_scope =
|
2243 | 2247 | (OpaqueType (loc, otype));
|
2244 | 2248 | this#in_new_tparams_env (fun () -> super#opaque_type loc otype)
|
2245 | 2249 |
|
2246 |
| -method private visit_type_param ~from_infer_type (tparam : ('loc, 'loc) Ast.Type.TypeParam.t) = |
| 2250 | +method private visit_type_param |
| 2251 | +~from_infer_type ~kind (tparam : ('loc, 'loc) Ast.Type.TypeParam.t) = |
2247 | 2252 | let open Ast.Type.TypeParam in
|
2248 | 2253 | let (_, { name = (name_loc, { Ast.Identifier.name; _ }); _ }) = tparam in
|
2249 | 2254 | this#force_add_binding
|
2250 | 2255 | (Env_api.OrdinaryNameLoc, name_loc)
|
2251 | 2256 | (mk_reason (RType (OrdinaryName name)) name_loc)
|
2252 | 2257 | (TypeParam { tparams_map = tparams; from_infer_type; tparam });
|
2253 | 2258 | this#add_tparam name_loc name;
|
2254 |
| -super#type_param tparam |
| 2259 | +super#type_param ~kind tparam |
2255 | 2260 |
|
2256 | 2261 | method! infer_type t =
|
2257 | 2262 | let open Ast.Type.Infer in
|
2258 | 2263 | let { tparam; comments } = t in
|
2259 |
| -{ tparam = this#visit_type_param ~from_infer_type:true tparam; comments } |
| 2264 | +{ |
| 2265 | +tparam = this#visit_type_param ~from_infer_type:true ~kind:Flow_ast_mapper.InferTP tparam; |
| 2266 | +comments; |
| 2267 | +} |
2260 | 2268 |
|
2261 |
| -method! type_param = this#visit_type_param ~from_infer_type:false |
| 2269 | +method! type_param ~kind = this#visit_type_param ~from_infer_type:false ~kind |
2262 | 2270 |
|
2263 | 2271 | method! interface loc (interface : ('loc, 'loc) Ast.Statement.Interface.t) =
|
2264 | 2272 | let open Ast.Statement.Interface in
|
|
0 commit comments