diff --git a/changes/jsx-component-without-make.polish.md b/changes/jsx-component-without-make.polish.md new file mode 100644 index 0000000000..4354057b7c --- /dev/null +++ b/changes/jsx-component-without-make.polish.md @@ -0,0 +1 @@ +- Explain that a JSX tag needs a component module that defines `make`, when the module it names doesn't. https://github.com/rescript-lang/rescript/pull/8885 diff --git a/compiler/ml/typecore.ml b/compiler/ml/typecore.ml index a8766cee57..93fd3c507b 100644 --- a/compiler/ml/typecore.ml +++ b/compiler/ml/typecore.ml @@ -98,6 +98,7 @@ type error = | Type_params_not_supported of Longident.t | Field_access_on_dict_type | Jsx_not_enabled + | Jsx_component_without_make of Longident.t | Jsx_unboxed_props of type_expr | Tagged_template_non_tag of type_expr | Record_rest of Typecore_record_rest.error @@ -2530,12 +2531,20 @@ and type_expect_ ?deprecated_context ~context ?(recarg = Rejected) env sexp {exp with exp_attributes = sexp.pexp_attributes @ exp.exp_attributes} | Pexp_ident lid -> let path, desc = - Typetexp.find_value - ?deprecated_context: - (match deprecated_context with - | None -> Some Reference - | v -> v) - env lid.loc lid.txt + try + Typetexp.find_value + ?deprecated_context: + (match deprecated_context with + | None -> Some Reference + | v -> v) + env lid.loc lid.txt + with + | Typetexp.Error (_, _, Unbound_value (Ldot (module_lid, "make"))) + when context = Some JsxComponent + -> + (* [