You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f7220bf
Browse filesBrowse the repository at this point in the historyBrowse files
`<Button />` refers to `Button.make`. When `Button` exists but defines no
`make` value, the type checker now says that the module can't be used as a
JSX component and shows what a component module looks like, instead of
the generic "The value make can't be found in Button". The spellcheck hint
for a near miss such as `mak` is kept. A missing module, a functor, and a
`make` that is not a component report as before.
Example (rescript):
module Ui = {
module Button = {
let label = "x"
}
}
let x = <Ui.Button />
Before (text):
The value make can't be found in Ui.Button
After (text):
The module Ui.Button can't be used as a JSX component, because it has no
make value.
A component module defines its component as make, for example:
@react.component
let make = (~label) => ...
Review: How does the type checker know the identifier is a JSX tag?
The JSX transform passes the tag as the first argument of a
`transformed_jsx` application, which the type checker already types with
the `JsxComponent` context. The new error replaces only an unbound
`<Module>.make` in that context; the lookup reports an unbound module
before it gets there.
Area: typechecker tests
Output: unchanged
Formats: none
Editor: editor diagnostics show the new message; no analysis fixture
changes
Errors: +Jsx_component_without_make (jsx_component_without_make.res,
jsx_component_without_make_typo.res)
Tests: +tests/build_tests/super_errors/fixtures/jsx_component_without_make.res
+tests/build_tests/super_errors/fixtures/jsx_component_without_make_typo.res
PR: #8885
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014hcyfimX2ss8qj5MZwdMdP
Signed-off-by: Christoph Knittel <ck@cca.io>
- Explain that a JSX tag needs a component module, with a `make` value, when the module it names has none. https://github.com/rescript-lang/rescript/pull/8885
Copy file name to clipboardExpand all lines: tests/ERROR_VARIANTS.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -252,6 +252,7 @@ Source: `type error` in [typecore.ml](../compiler/ml/typecore.ml).
252
252
|`Type_params_not_supported`| ✓ |`variant_spread_pattern_type_params.res`| Pattern-level variant spread (`| ...a as v`) where `a` has type params; typedecl path covered by `variant_spread_type_parameters.res`. |
|`Jsx_not_enabled`| ☐ (needs harness flag) | — | typecore.ml, the `Pexp_jsx_element` cases of `iter_expression` and `type_expect_`. Fires when JSX is used without `-bs-jsx N`. The `super_errors` runner hard-codes `-bs-jsx 4` in `bscFlags`; adding a per-fixture opt-out (e.g. a `.opts` sidecar) would expose this. Until then, it's reachable in real code but blocked at the harness level. |
255
+
|`Jsx_component_without_make`| ✓ |`jsx_component_without_make.res`, `jsx_component_without_make_typo.res`| A JSX tag naming a module that has no `make` value; the typo fixture pins the spellcheck hint. |
255
256
|`Jsx_unboxed_props`| ✓ |`jsx_unboxed_props.res`, `jsx_unboxed_props_spread.res`| A JSX element whose props have an `@unboxed` record type, given as attributes or as a spread. |
256
257
|`Tagged_template_non_tag`| ✓ |`tagged_template_non_tag.res`| Backtick tagged-template syntax used on a value whose type is not `taggedTemplate<'param, 'output>`. |
0 commit comments