Repository navigation
Warn when other modules can't inline an @inline function - #9482
Conversation
Changelog🚀 New Feature
Semantic Diff1 commit · Full page Warn when other modules can't inline an
|
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c715ba1751
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
| Benchmark | Base | Head | Change |
|---|---|---|---|
build/no-op |
9,345,290 | 10,222,715 | +9.39% |
build/leaf-edit |
12,078,029 | 12,955,517 | +7.27% |
build/shared-edit |
87,812,795 | 88,045,730 | +0.27% |
build/Namespace/clean |
84,736,757 | 84,880,848 | +0.17% |
packages/@rescript/runtime/Primitive_list.resi |
92,021 | 92,171 | +0.16% |
packages/@rescript/runtime/Primitive_float_extern.res |
93,881 | 94,031 | +0.16% |
packages/@rescript/runtime/Stdlib_Blob.res |
94,098 | 94,248 | +0.16% |
packages/@rescript/runtime/Stdlib_File.res |
95,907 | 96,057 | +0.16% |
packages/@rescript/runtime/Primitive_promise.res |
97,257 | 97,407 | +0.15% |
packages/@rescript/runtime/Primitive_int_extern.res |
98,110 | 98,260 | +0.15% |
43 more changes
| Benchmark | Base | Head | Change |
|---|---|---|---|
packages/@rescript/runtime/Stdlib_Iterable.resi |
98,227 | 98,377 | +0.15% |
packages/@rescript/runtime/Stdlib_AsyncIterable.resi |
98,376 | 98,526 | +0.15% |
packages/@rescript/runtime/Primitive_string_extern.res |
98,418 | 98,568 | +0.15% |
packages/@rescript/runtime/Stdlib_Iterable.res |
99,138 | 99,288 | +0.15% |
packages/@rescript/runtime/Stdlib_AsyncIterable.res |
99,209 | 99,359 | +0.15% |
packages/@rescript/runtime/Obj.res |
99,358 | 99,508 | +0.15% |
packages/@rescript/runtime/RescriptTools.res |
104,773 | 104,931 | +0.15% |
packages/@rescript/runtime/Primitive_exceptions.resi |
100,449 | 100,599 | +0.15% |
packages/@rescript/runtime/Primitive_hash.resi |
102,866 | 103,016 | +0.15% |
packages/@rescript/runtime/Primitive_dict.res |
102,910 | 103,060 | +0.15% |
packages/@rescript/runtime/Primitive_module.resi |
103,308 | 103,458 | +0.15% |
packages/@rescript/runtime/Stdlib_TaggedTemplate.resi |
106,192 | 106,342 | +0.14% |
packages/@rescript/runtime/Stdlib_ArrayBuffer.res |
107,734 | 107,884 | +0.14% |
packages/@rescript/runtime/Stdlib_ArrayBuffer.resi |
110,990 | 111,140 | +0.14% |
packages/@rescript/runtime/Stdlib_Lazy.resi |
112,282 | 112,432 | +0.13% |
packages/@rescript/runtime/RescriptTools_ExtractCodeBlocks.res |
112,334 | 112,484 | +0.13% |
packages/@rescript/runtime/Stdlib_TaggedTemplate.res |
115,668 | 115,822 | +0.13% |
packages/@rescript/runtime/Primitive_array_extern.res |
114,418 | 114,568 | +0.13% |
packages/@rescript/runtime/Primitive_object_extern.res |
114,929 | 115,079 | +0.13% |
packages/@rescript/runtime/Stdlib_Bool.resi |
116,502 | 116,652 | +0.13% |
packages/@rescript/runtime/Stdlib_Intl_Segments.res |
116,797 | 116,947 | +0.13% |
packages/@rescript/runtime/Primitive_object.resi |
117,223 | 117,373 | +0.13% |
packages/@rescript/runtime/Dom_storage2.res |
120,383 | 120,533 | +0.12% |
packages/@rescript/runtime/Jsx.res |
121,938 | 122,088 | +0.12% |
packages/@rescript/runtime/Primitive_option.resi |
122,313 | 122,463 | +0.12% |
packages/@rescript/runtime/Stdlib_JsExn.resi |
122,399 | 122,549 | +0.12% |
packages/@rescript/runtime/Stdlib_WeakSet.res |
123,370 | 123,520 | +0.12% |
packages/@rescript/belt/src/Belt.res |
188,641 | 188,863 | +0.12% |
packages/@rescript/runtime/Stdlib_Global.res |
142,018 | 142,176 | +0.11% |
packages/@rescript/runtime/Stdlib_Bool.res |
146,429 | 146,591 | +0.11% |
packages/@rescript/runtime/Stdlib_WeakMap.res |
135,702 | 135,852 | +0.11% |
packages/@rescript/runtime/Stdlib_Ordering.res |
153,831 | 154,001 | +0.11% |
packages/@rescript/runtime/Stdlib_Type.resi |
135,854 | 136,004 | +0.11% |
packages/@rescript/runtime/Primitive_float.res |
147,320 | 147,482 | +0.11% |
packages/@rescript/runtime/Primitive_bool.res |
147,669 | 147,831 | +0.11% |
packages/@rescript/runtime/Stdlib_Intl.res |
174,368 | 174,558 | +0.11% |
build/Namespace/edit |
7,934,460 | 7,942,816 | +0.11% |
packages/@rescript/runtime/Stdlib_Temporal_Now.res |
143,694 | 143,844 | +0.10% |
packages/@rescript/runtime/Primitive_string.res |
160,064 | 160,230 | +0.10% |
packages/@rescript/runtime/Stdlib_JsExn.res |
173,722 | 173,900 | +0.10% |
packages/@rescript/runtime/Stdlib_Symbol.res |
146,723 | 146,873 | +0.10% |
packages/@rescript/runtime/Stdlib_IterableIterator.resi |
149,075 | 149,225 | +0.10% |
packages/@rescript/belt/src/Belt_Int.resi |
149,340 | 149,490 | +0.10% |
Instructions
In total: 9,226,120,339 → 9,226,238,564 (±0.00%).
| Benchmark | Base | Head | Change |
|---|---|---|---|
packages/@rescript/runtime/Stdlib_Math.resi |
21,271,384 | 21,247,304 | -0.11% |
Output size
In total: 27,367,799 → 27,369,129 (±0.00%).
None of the 13 benchmarks changed by 0.1% or more.
Pull request ac21673 compared with base e4d3187 in this run.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## inline-exports-bodies #9482 +/- ##
======================================================
Coverage 82.46% 82.47%
======================================================
Files 465 466 +1
Lines 66011 66055 +44
======================================================
+ Hits 54439 54481 +42
- Misses 11572 11574 +2
🚀 New features to boost your workflow:
|
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
c715ba1 to
241f209
Compare
241f209 to
136d8b7
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 136d8b71ef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
136d8b7 to
87c2e43
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 87c2e4311c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
87c2e43 to
7c6a5eb
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
bbace4e to
4c21005
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c210053d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
4c21005 to
747d0b2
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Why:
An exported `@inline` function stores its body for other modules
only when it can: it must be closed, not async, without a directive,
and must not call a relative-path external. Otherwise other modules
called it, and nothing said so. Warning 113, on by default, now names
the reason. It is a warning, not an error, since the function is still
inlined in its own module.
Diagnostic added (exported @inline function that isn't stored):
Example:
let rec helper = x => x > 10 ? x : helper(x + 1)
@inline let usesHelper = x => helper(x) + 1
@inline let asyncOne = async x => x
Before (diagnostic): none
After (diagnostic):
Warning number 113
This @inline function is inlined only in this module, not in modules that use it: it uses helper, a value of this module.
Warning number 113
This @inline function is inlined only in this module, not in modules that use it: it is async.
Review: The warning is reported while the .cmj is built, after type
checking. Do `-warn-error +113`, `@warning("-113")` and
`@warnerror("+113")` still apply? Yes. The check for fatal warnings now
runs after the .cmj is built, and the type checker records the warning
state of each `@inline` value binding, whose `@inline` may be on the
binding or on its function (`let f = {@inline x => …}`), and of each
`@inline` module binding, whose `@inline` may be below a module type
constraint. Other bindings aren't recorded, which keeps the cost away from
the many bindings without `@inline`. The state
holds the binding's `@warning` and `@warnerror`, those on its expression and
a `@@warning` above it, under the binding's identifier
(`Inline_not_stored`). Warning 113 is reported in that state, so a silenced
value in a nested module doesn't silence another of the same name.
Review: Does it fire for functions an interface hides? No. Only exported
values are considered, so an `@inline` helper the `.resi` leaves out is
inlined in its module without a warning. Functions in nested modules and
`@inline let rec` are not covered either.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gJwNt3jmNq5d8xKA9D
Signed-off-by: Christoph Knittel <ck@cca.io>
747d0b2 to
ac21673
Compare
Adds warning 113, on by default, for an exported
@inlinefunction that other modules can't inline. It names the reason:It's a warning, not an error, since the function is still inlined in its own module. A project can make it an error with
--warn-error +113, and one binding can turn it off with@warning("-113").The warning is reported while the
.cmjis built, after type checking, where the warning scopes of a binding are gone. So:.cmjis built;@inlinebinding, with its@warningand@warnerror, those on its expression and a@@warningabove it, under the binding's identifier (Inline_not_stored). The@inlinemay be on the binding, on its function, or below a type constraint.Not covered: functions in nested modules and
@inline let rec, which aren't stored for other modules either.New tests:
tests/error_tests/single/fixtures/warning_113_inline_not_stored.res: each reason, a silenced binding and a stored function.tests/build_tests/projects/inline_warning_as_error:--warn-error +113fails the build.Two existing tests get the warning where it is correct and intended.
inline_static_exit_test.resinlines within its own module only, so it gets an interface that exports nothing. #9475'scross_module_relative_externalproject, whose exported wrapper calls a relative-path external, makes every warning but 113 an error and checks that 113 is reported.The benchmarks'
build/no-opandbuild/leaf-editgrow because they build the base's test sources with this PR's compiler. Those sources don't have the interface this PR adds forinline_static_exit_test.res, so that module gets warning 113, and the build system compiles a module with warnings again on every build to report them. A project without new warnings doesn't build more.Part of stack #9486, after #9479.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gJwNt3jmNq5d8xKA9D