From 0397e07b17b7790bb1fb62df93208055eb48c8ad Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Tue, 10 Nov 2026 20:37:55 +0000 Subject: [PATCH 1/3] Drop analysis's special case for ReasonReact.fragment Jsx_hacks kept ReasonReact's `fragment` out of the editor's index, a leftover from the ReasonReact JSX transform. ReScript's JSX doesn't produce it, so the module and its two guards go. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Kbf3gKyiYMf54wPRxFdUWe Signed-off-by: Christoph Knittel --- analysis/src/jsx_hacks.ml | 5 ----- analysis/src/process_cmt.ml | 2 +- analysis/src/process_extra.ml | 3 +-- 3 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 analysis/src/jsx_hacks.ml diff --git a/analysis/src/jsx_hacks.ml b/analysis/src/jsx_hacks.ml deleted file mode 100644 index 70db806dbfe..00000000000 --- a/analysis/src/jsx_hacks.ml +++ /dev/null @@ -1,5 +0,0 @@ -let path_is_fragment path = Path.name path = "ReasonReact.fragment" - -let primitive_is_fragment (vd : Typedtree.value_description) = - vd.val_name.txt = "fragment" - && vd.val_loc.loc_start.pos_fname |> Filename.basename = "ReasonReact.res" diff --git a/analysis/src/process_cmt.ml b/analysis/src/process_cmt.ml index 18d854a5244..523d90d13bb 100644 --- a/analysis/src/process_cmt.ml +++ b/analysis/src/process_cmt.ml @@ -617,7 +617,7 @@ let rec for_structure_item ~(env : Shared_types.Env.t) ~(exported : Exported.t) incl_type [] in top_level - | Tstr_primitive vd when Jsx_hacks.primitive_is_fragment vd = false -> + | Tstr_primitive vd -> let declared = add_declared ~extent:vd.val_loc ~item:vd.val_val.val_type ~name:vd.val_name diff --git a/analysis/src/process_extra.ml b/analysis/src/process_extra.ml index af339909f9d..83756bd5459 100644 --- a/analysis/src/process_extra.ml +++ b/analysis/src/process_extra.ml @@ -426,8 +426,7 @@ let pat ~(file : File.t) ~env ~extra (iter : Tast_iterator.iterator) let expr ~env ~(extra : extra) (iter : Tast_iterator.iterator) (expression : Typedtree.expression) = (match expression.exp_desc with - | Texp_ident (path, {txt; loc}, _) when not (Jsx_hacks.path_is_fragment path) - -> + | Texp_ident (path, {txt; loc}, _) -> add_for_longident ~env ~extra (Some (expression.exp_type, Value)) path txt loc From 6ee9580e090cde700809e61008bfd8004feaa12c Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Tue, 10 Nov 2026 20:37:56 +0000 Subject: [PATCH 2/3] Drop reference heuristics for JSX v3 names Three heuristics in References.get_loc_item matched makeProps and createDOMElementVariadic, which only the JSX v3 transform generated. The heuristics that match by location alone stay. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Kbf3gKyiYMf54wPRxFdUWe Signed-off-by: Christoph Knittel --- analysis/src/references.ml | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/analysis/src/references.ml b/analysis/src/references.ml index b5b143ebf52..90f9dc4d663 100644 --- a/analysis/src/references.ml +++ b/analysis/src/references.ml @@ -46,27 +46,6 @@ let get_loc_item ~full ~pos ~debug = | _ -> "NotFound" in match loc_items with - | li1 :: li2 :: li3 :: ({loc_type = Typed ("makeProps", _, _)} as li4) :: _ - when full.file.uri |> Uri.is_interface -> - log 1 "heuristic for makeProps in interface files"; - if debug then - Printf.printf "n1:%s n2:%s n3:%s\n" (name_of li1) (name_of li2) - (name_of li3); - Some li4 - | [ - {loc_type = Constant _}; - ({loc_type = Typed ("createDOMElementVariadic", _, _)} as li2); - ] -> - log 3 "heuristic for
"; - Some li2 - | {loc_type = Typed ("makeProps", _, _)} - :: ({loc_type = Typed ("make", _, _)} as li2) - :: _ -> - log 4 - "heuristic for within fragments: take make as makeProps does not \ - work\n\ - the type is not great but jump to definition works"; - Some li2 | [ ({loc_type = Typed (_, _, LocalReference _)} as li1); ({loc_type = Typed (_, _, _)} as li2); From 0d9f2a4c1b205f69381ded786f75d6efa67050f7 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Tue, 10 Nov 2026 20:37:56 +0000 Subject: [PATCH 3/3] Drop genType's mappings for ReasonReact and ReactDOMRe types genType translated ReactDOMRe.domRef, ReactDOMRe.Ref.currentDomRef and ReasonReact.reactElement, and skipped ReasonReact.res when resolving modules. Current React bindings have none of these modules; the ReactDOM and React mappings stay. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Kbf3gKyiYMf54wPRxFdUWe Signed-off-by: Christoph Knittel --- changes/remove-reason-react-leftovers.internal.md | 1 + compiler/gentype/gentype_main.ml | 2 +- compiler/gentype/translate_type_expr_from_types.ml | 5 ----- compiler/gentype/translation.ml | 4 ++-- 4 files changed, 4 insertions(+), 8 deletions(-) create mode 100644 changes/remove-reason-react-leftovers.internal.md diff --git a/changes/remove-reason-react-leftovers.internal.md b/changes/remove-reason-react-leftovers.internal.md new file mode 100644 index 00000000000..79ee1c1663b --- /dev/null +++ b/changes/remove-reason-react-leftovers.internal.md @@ -0,0 +1 @@ +- Remove ReasonReact and JSX v3 leftovers from editor analysis and genType. diff --git a/compiler/gentype/gentype_main.ml b/compiler/gentype/gentype_main.ml index a9c0d911800..076e2a6b334 100644 --- a/compiler/gentype/gentype_main.ml +++ b/compiler/gentype/gentype_main.ml @@ -158,7 +158,7 @@ let process_cmt_file cmt = let resolver = Module_resolver.create_lazy_resolver ~config ~extensions:[".res"; ".shim.ts"] ~exclude_file:(fun fname -> - fname = "React.res" || fname = "ReasonReact.res") + fname = "React.res") in if has_gentype_annotations then input_cmt diff --git a/compiler/gentype/translate_type_expr_from_types.ml b/compiler/gentype/translate_type_expr_from_types.ml index 33a2d33c954..735ea084a98 100644 --- a/compiler/gentype/translate_type_expr_from_types.ml +++ b/compiler/gentype/translate_type_expr_from_types.ml @@ -389,14 +389,9 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env = {dependencies = []; type_ = Emit_type.type_react_dom_re_dom_ref} | ["ReactDOM"; "Ref"; "currentDomRef"], [] -> {dependencies = []; type_ = Emit_type.type_any} - | ["ReactDOMRe"; "domRef"], [] -> - {dependencies = []; type_ = Emit_type.type_react_dom_re_dom_ref} - | ["ReactDOMRe"; "Ref"; "currentDomRef"], [] -> - {dependencies = []; type_ = Emit_type.type_any} | ["ReactEvent"; "Mouse"; "t"], [] -> {dependencies = []; type_ = Emit_type.type_react_event_mouse_t} | ( ( ["React"; "element"] - | ["ReasonReact"; "reactElement"] | ["Pervasives"; "Jsx"; "element"] | ["Jsx"; "element"] ), [] ) -> diff --git a/compiler/gentype/translation.ml b/compiler/gentype/translation.ml index 1a59c092d49..3ea3b38ee5f 100644 --- a/compiler/gentype/translation.ml +++ b/compiler/gentype/translation.ml @@ -120,8 +120,8 @@ let translate_value ~attributes ~config ~doc_string ~output_file_relative } (** - [@genType] - [@module] external myBanner : ReasonReact.reactClass = "./MyBanner"; + @genType @module("./MyBanner") + external make: React.component = "default" *) let translate_primitive ~config ~output_file_relative ~resolver ~type_env (value_description : Typedtree.value_description) : t =