Skip to content

Commit dc49881

Browse files
committed
Fix unnecessary boxing of Some(React.component)
1 parent 29cce31 commit dc49881

4 files changed

Lines changed: 6 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
- Fix namespaced reference lookup in editor analysis. https://github.com/rescript-lang/rescript/pull/8455
4141
- Fix analysis segmentation fault for references after https://github.com/rescript-lang/rescript/pull/7887. https://github.com/rescript-lang/rescript/pull/8477
4242
- Fix build crash when the compiler emits output that is not valid UTF-8, such as a truncated multibyte character in a code frame. https://github.com/rescript-lang/rescript/pull/8482
43+
- Fix unnecessary boxing of `Some(React.component)`. https://github.com/rescript-lang/rescript/pull/8500
4344

4445
#### :memo: Documentation
4546

packages/@rescript/runtime/Jsx.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type componentLike<'props, 'return> = 'props => 'return
2020
/* Components consume props. If one component can accept broader props, it can
2121
safely stand in for a component that only needs narrower props, just like a
2222
function argument type. That makes the props parameter contravariant. */
23+
@notUndefined
2324
type component<-'props>
2425

2526
/* this function exists to prepare for making `component` abstract */

tests/tests/src/option_wrapping_test.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ let x47 = {};
7272

7373
let x48 = Stdlib_Lazy.make(() => true);
7474

75+
let x49 = param => null;
76+
7577
let x1 = "hello";
7678

7779
let x2 = 1;
@@ -139,5 +141,6 @@ export {
139141
x46,
140142
x47,
141143
x48,
144+
x49,
142145
}
143146
/* x20 Not a pure module */

tests/tests/src/option_wrapping_test.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ let x45 = Some(Promise.resolve(true))
5252
let x46 = Some(list{})
5353
let x47 = Some((Dict.make(): dict<string>))
5454
let x48 = Some(Lazy.make(_ => true))
55+
let x49 = Some(Jsx.component(_ => Jsx.null))

0 commit comments

Comments
 (0)