Repository navigation
Conversation
Changelog🚀 New Feature
🐛 Bug fix
Semantic Diff1 commit · Full page ✏️ Export
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9526 +/- ##
==========================================
+ Coverage 82.59% 82.68% +0.09%
==========================================
Files 468 469 +1
Lines 66296 66597 +301
==========================================
+ Hits 54754 55067 +313
+ Misses 11542 11530 -12
🚀 New features to boost your workflow:
|
|
| Benchmark | Base | Head | Change |
|---|---|---|---|
packages/@rescript/runtime/Stdlib_Ordering.res |
152,661 | 155,677 | +1.98% |
packages/@rescript/runtime/Stdlib_Int.res |
445,251 | 446,026 | +0.17% |
Instructions
In total: 8,976,933,908 → 8,977,999,362 (+0.01%).
| Benchmark | Base | Head | Change |
|---|---|---|---|
packages/@rescript/runtime/Stdlib_Math.resi |
21,254,630 | 21,297,098 | +0.20% |
packages/@rescript/runtime/Stdlib_Temporal_PlainDate.res |
24,107,389 | 24,148,812 | +0.17% |
packages/@rescript/runtime/Stdlib_Temporal_PlainDateTime.res |
25,570,142 | 25,612,932 | +0.17% |
packages/@rescript/runtime/Stdlib_List.resi |
24,530,881 | 24,570,206 | +0.16% |
packages/@rescript/runtime/Stdlib_String.resi |
29,379,782 | 29,422,776 | +0.15% |
packages/@rescript/runtime/Stdlib_Temporal_ZonedDateTime.res |
31,229,325 | 31,274,798 | +0.15% |
packages/@rescript/runtime/Stdlib_Date.resi |
34,183,528 | 34,228,981 | +0.13% |
parse/RedBlackTree.res |
14,911,369 | 14,930,927 | +0.13% |
parse/RedBlackTreeNoComments.res |
14,499,103 | 14,517,581 | +0.13% |
packages/@rescript/belt/src/Belt_Array.resi |
33,713,161 | 33,755,473 | +0.13% |
3 more changes
| Benchmark | Base | Head | Change |
|---|---|---|---|
packages/@rescript/runtime/Stdlib_TypedArray.res |
41,320,511 | 41,368,976 | +0.12% |
packages/@rescript/runtime/Stdlib_Array.resi |
39,968,098 | 40,013,033 | +0.11% |
packages/@rescript/belt/src/Belt_List.resi |
38,958,272 | 38,998,343 | +0.10% |
Output size
In total: 27,594,641 → 27,595,022 (±0.00%).
None of the 13 benchmarks changed by 0.1% or more.
Pull request 0895c16 compared with base 4375d6e in this run.
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
Why:
An @inline constant was only a primitive, so its module had no field
for it: the JS output did not export it, genType silently dropped
`@genType @inline let x = 42`, and hiding one behind a plain `let x: int`
in an interface rebuilt the constant in a coercion. Now the constant is
also an ordinary field of its module (proposal 5 of #8733). Uses in
ReScript still get the literal, read from the .cmi as before.
`Types.is_module_field` decides which values are fields, and every place
that counts field positions or skips primitives uses it.
JS modified (a module with @inline constants):
Example:
@inline let less = -1
module Nested = {
@inline let label = "nested"
}
let pair = (less, Nested.label)
Before (js):
let Nested = {};
let pair = [
-1,
"nested"
];
export {
Nested,
pair,
}
After (js):
let Nested = {
label: "nested"
};
let less = -1;
let pair = [
-1,
"nested"
];
export {
less,
Nested,
pair,
}
JS modified (a constant in a recursive module):
Example:
module rec A: {
@inline(9) let k: int
let f: unit => int
} = {
@inline let k = 9
let f = () => B.g()
}
and B: {
let g: unit => int
} = {
let g = () => A.k + 1
}
After (js):
let A = Primitive_module.init([
"x.res",
1,
4
], {
TAG: "Module",
_0: [
[
{
TAG: "Value",
_0: 9
},
"k"
],
[
"Function",
"f"
]
]
});
…
Diagnostic modified (a constant takes its JavaScript name):
Example:
@inline let \"a-b" = 1
let a$b = 2
After (diagnostic):
This value has the same JavaScript name a$b
as the value at x.res:1:1-22.
Rename one of them.
Reanalyze modified (an unused @inline constant):
Example:
@inline let unusedConst = 2
After (reanalyze):
Warning Dead Value
x.res:1:1-27
unusedConst is never used
Review: Does an interface still decide what other modules inline? Yes.
`@inline(c) let x: t` in a .resi still needs an @inline implementation with
the same constant, and a plain `let x = c` still does not match it. A plain
`let x: t` hides the constant: other modules read the field, which is now
the implementation's own binding instead of a coercion that rebuilt it.
Review: Why do Int.Constants and Ordering change in the runtime? Their
constants are @inline, so `Stdlib_Int.Constants.minValue` and `maxValue`
and `Stdlib_Ordering.less`, `equal` and `greater` are now exported. The
unreleased changelog entries that said constants have no export are
updated, and the breaking entry for `Int.Constants` is dropped: with the
export back, nothing about it breaks.
Review: Why does a module alias in a recursive module now get the tag
`Value` instead of `value`? Constants and aliases share one shape tag, and
`Value` is the name of the runtime constructor. The runtime only tests for
`Module`, so both spellings behave the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gHZYwA1rq7zbk3dhQq
Signed-off-by: Christoph Knittel <ck@cca.io>
0c59094 to
0895c16
Compare
|
@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. |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! 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". |
@inlineconstants are now exported from their module, like any otherlet. Uses in ReScript still get the literal.Until now an
@inlineconstant was only a primitive, like an external, so its module had no field for it:@genType @inline let x = 42out of the.gen.tsx;@inline let x: int = 3) are@inlineconstants too, so they lost the export they had as ordinary values;@inlineconstant was used through an interface that declares a plainlet, such as a functor argument or a first-class module, the compiler couldn't pass the module itself. It built a new object with the constant added. The module, as exported or as passed to JavaScript, lacked the field:Before:
After:
This is proposal 5 of #8733. It lands before the next release, so the exports #9467 removed never ship missing.
Before:
After:
The constant stays a primitive in the
.cmi, so other modules still inline it. In addition it now counts as a field of its module.Types.is_module_fielddecides that, and every place that counts field positions or skips primitives uses it: module paths, signature inclusion and coercions,include, recursive modules, JS name clashes and genType.What else changes:
@inline(c) let x: tin a.resistill needs an@inlineimplementation with the same constant. A plainlet x: thides the constant: other modules read the field, which is now the implementation's own binding instead of a copy built by the coercion.Stdlib_Int.Constants.minValue/maxValueandStdlib_Ordering.less/equal/greaterare exported again.letin a.resi.@inlineconstant as a dead value, as it does for other values.New tests:
inline_const_export_testchecks the exports by importing them from the generated JavaScript: every literal kind, nested modules, interfaces that hide or reorder fields, functors,include, module aliases, first-class modules andmodule rec;letstill doesn't satisfy@inline(1)in an interface;🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gHZYwA1rq7zbk3dhQq