Repository navigation
13.0.0-alpha.7
Pre-release
Pre-release
·
91 commits
to master
since this release
Immutable
release. Only release title and notes can be modified.
⭐ Highlights
- New build system
rescriptnow runs a build system rewritten in OCaml that compiles modules in-process on several CPU cores. The Rust implementation remains available asrescript-rust. #8780 #8781 #9170- Modules with many JSX DOM elements compile up to 10× faster, with
.cmtfiles up to 30× smaller. #9149 - Large char ranges, list literals, nested inlining and
let recgroups no longer take quadratic time. #8893 #8794 #8801 #9153
- New language features
- Untagged variants for JavaScript classes
- Standard library
Temporalbindings. #9094
- React Server Components
- Nested components such as
<Sidebar.Provider />work as client references. #8904
- Nested components such as
- Error messages
- Upgrading from v12
- The APIs deprecated in v12 are removed; run
rescript-tools migrate-allwith 12.3.2 before upgrading. #9052 @deriving(abstract)and@deriving(jsConverter), the@ocaml.*attributes,@ocaml.doc/@ns.docdoc comments, record syntax for dicts and macOS Intel support are removed. See the breaking changes below. #8729 #8928 #8992 #8751 #8912
- The APIs deprecated in v12 are removed; run
💥 Breaking Change
- Records whose fields are named
"0","1", … with@asare JavaScript arrays; record rest patterns, coercions and untagged variants that would treat them as objects are now errors. #9224 - Replace
%debuggerwith adebugger()function. #9163 - Coercing another type into a private record or variant is an error. #9125
TypedArray.mapandTypedArray.mapWithIndexkeep the element type. #9112- The new
Temporalstdlib module shadows project modules namedTemporal; nested modules namedTemporalare exported to JavaScript as$$Temporal. #9094 - Remove the stdlib APIs deprecated in v12, such as
List.has,ErrorandExn; runrescript-tools migrate-allwith 12.3.2 first. #9052 - Typed array types such as
Int8Array.tare no longer interchangeable; upcast with:> TypedArray.t<_>to use the genericTypedArrayfunctions. #9050 @unboxedcan only be written on a variant type, not on a constructor. On the type, it makes a single-field inline record payload the field itself instead of the record object; give the record type a name to keep the object. #9040.cmiand.cmtfiles use ReScript magic numbers, so tools that read them as OCaml files no longer accept them. #9000- Read doc comments only from
/** */;@ocaml.docand@ns.docare ignored. #8992 - Remove the
@ocaml.*attribute spellings, such as@ocaml.warning, and%extension_constructor; PPX output keeps working. #8928 - Drop support for macOS on Intel (darwin-x64). Intel Mac users can stay on ReScript 12. #8912
- Remove
@res.hoistedFunction; nested functions other thanmakeare no longer exported as top-levelA$B$fvalues. #8904 \"_"is no longer a valid quoted identifier. #8795rescriptignoresRESCRIPT_BSC_EXE; onlyrescript-rustreads it. #8781rescriptrejects duplicate keys inrescript.json,namespace-entrywithoutnamespaceand a value after--no-timing. #8780rescript --filtersupports only common regular expression syntax. #8780- A failing
--after-buildcommand fails the build. #8780 rescript format -vandrescript compiler-args -vwrite their logs to stderr instead of stdout. #8780rescriptdoes not export OpenTelemetry traces;rescript-ruststill does. #8780- Record syntax no longer creates or matches dicts, e.g.
let d: dict<int> = {foo: 1}; it's an error pointing todict{...}. #8751 - Remove the call-site
@inlinedattribute, which had no effect. #8734 - Remove the builtin primitives
%obj_is_int,%obj_dup,%obj_field,%array_safe_set,%null_to_optand%nullable_to_opt. #8731 - Remove the
-ppcompiler flag, which had no effect. #8731 - Remove
@deriving(abstract)and@deriving(jsConverter); use records and polymorphic variants directly. #8729
🚀 New Feature
- Add
Temporalbindings to the standard library. #9094 - Allow coercing iterator, generator,
Array.arrayLikeandtaggedTemplatetypes through their type parameters, e.g.Iterator.t<sub>toIterator.t<super>. #8981 - Add
@instanceOfand@typeOf, so that JavaScript classes and opaque primitive types can be untagged variant cases. #8950 #9017 #9050 for..ofandfor await..ofaccept generators and other iterator types directly, withoutasIterable. #8937- Add
try ... finally { ... }andtry ... catch { ... } finally { ... }, compiled to JavaScriptfinallyblocks. #8931 - Export nested
makefunctions flat (A$B$make), so that nested components work as React Server Components client references. #8904 - Support int range patterns such as
200 .. 299. #8894 - Make
charan alias ofint. #8892 - Allow
$in identifiers, e.g.let count$ = signal(0). #8791 rescriptnow runs a build system rewritten in OCaml; the Rust implementation remains available asrescript-rust. #8780- Allow an untagged variant to have both a
trueorfalseliteral case and aboolpayload case. #8777 #9036
🐛 Bug fix
- Keep records with fields named
"0","1", … JavaScript arrays when they are spread, written as{}or defined withlet rec, and match them as arrays in untagged variants. #9224 #9232 - Reject
awaitin a functor body, which produced invalid JavaScript. #9220 - Reject coercing
unittostringand polymorphic variants toboolorunit. #9218 - Reject spreading
boolorunitinto a variant. #9218 - Fix an
@stringor@intargument of an external being evaluated twice, as inon(t, mk()), or breakingawait. #9217 - Parse several doc comments before the
|of a variant constructor, as the formatter prints them. #9203 - Complete array elements after a spread, such as
[...xs, <cursor>]. #9199 - Fix
await,breakandcontinuein awhilecondition. #9177 - Stop the optimizer from replacing an
asyncor@directivefunction that only forwards its parameters with the function it calls, as inlet g = async n => f(n). #9176 - Reject
awaitin a function that an async function returns, as inasync x => y => await y. #9169 - Fix the end location of template literals without interpolations when PPXs are used. #9166
- Fix
%todocalling a user-definedJsErrormodule instead of the standard library one. #9160 - Show the file name and columns in the
%todoerror location. #9160 - Fix an argument or literal element being evaluated after a later one that is a
{ ... }block with statements. #9159 - Fix a type hole where a record spread or
{}with a mutable field could store a value at one type and read it at another. #9158 #9152 - Editor "find references" on a record field no longer lists record literals that leave the optional field out. #9149
- Reject
@@jsxConfigversions other than 4 instead of disabling the JSX transform. #9145 - Print non-ASCII
@asnames and external strings as written instead of as escapes. #9143 - Keep
@tag,@notUndefined,@instanceOfand@typeOfin printed type declarations. #9136 - Fix a
switchon a mutable field taking a case that no longer matches after a guard changed the field. #9131 - Accept attributes on a
letthat destructures a GADT constructor. #9128 - Keep comments around a lone list pattern spread, as in
list{/* c */ ...r}, when formatting. #9127 - Accept a UTF-8 byte order mark and lines that end in a carriage return alone. #9120
- Fix the formatter misplacing doc comments and comments in several positions. #9119
- Fix the coercion hint after a parenthesized operand. #9118
- Evaluate JSX children after the other props in plain JSX mode, as in preserve mode. #9117
- Make the formatter keep line breaks inside literals as written. #9116
- Accept attributes and doc comments after
= privateand doc comments after=in type declarations. #9115 - Fix the JavaScript simplifier treating equal float constants as different, which turned
x == 2.5 && x == 2.5intofalse. #9114 - Fix untagged variant matches with both
trueandfalseliteral cases skipping the other checks. #9113 - Type the typed arrays'
copyWithinandcopyAllWithinas returning the typed array. #9112 - Fix the formatter moving attributes onto a labeled parameter alias like
~a as x. #9111 - Fill cases added by editor code actions with
%todo. #9110 - Record coercion no longer makes an immutable field mutable or changes a mutable field's type. #9086
- Keep
let f: type a. t => a = x =>on one line when it fits. #9082 - Keep attributes and doc comments, fix indentation, and print the types of applied functors and includes in interfaces created by the editor. #9077 #9096 #9144 #9207
- Keep a line comment in a
switch,if,tryor loop operand in place when formatting. #9061 - Parse a doc comment before a function parameter. #9055
- Print a type reached through a module alias only once in type errors. #9054
- Suggest a coercion to the whole expected type, not the nested part that differs. #9053
- Make the formatter keep each file's line endings, also on Windows. #9042 #9201
- On Windows, fix removing
lib/watch.locksometimes failing to stop a watcher. #9034 - Make editor analysis output work outside VS Code. #9031
- Fix negated float comparisons with NaN, such as
!(x < 0.0). #9024 - Fix a stack overflow when compiling
optionof a recursive@unboxedvariant. #9019 - Fix untagged variant switches with a
_arm sending class instances or literals it should handle to a named arm. #9010 - Reject an implementation whose variant
@astags differ from its interface. #9009 - Keep
Some(U)distinct fromNonewhenUis@as(undefined). #9008 - Print
privatefor abbreviations and variants in type errors. #8999 - Show polymorphic variant labels like
#644in completion as the formatter prints them. #8990 - genType emits
charasnumber. #8988 - Report an error when two bindings get the same JavaScript name, such as
deleteand$$delete. #8982 - Reject
@asliterals of one variant with the same JavaScript value, such as@as(1)and@as(1.0). #8965 - Reject an implementation that can hold
undefinedfor a type its interface declares@notUndefined. #8950 - Match
FilebeforeBlobin untagged variants whatever the case order, and allowJsError.t,Symbol.tand theIntlclasses as cases. #8950 - Stop
rescriptfrom recompiling unchanged modules on every build when a source dir is"."or"./src". #8940 - Fix builds of a namespaced package failing with "… is an alias for module …, which is missing", or staying stale, when a module refers to a sibling as
Namespace.Module. #8939 - Evaluate the callee and arguments of a partial application
f(a, ...)once, so thatawaitworks in them. #8936 - Parse a switch guard that calls a function named
async. #8935 - Reject a
rescript.jsonnamespace that is not a valid module name. #8927 - Show compiled file names as written, such as
ABC.cmiinstead ofaBC.cmi, on case-insensitive file systems. #8925 - Warn when a
@deprecatedbinding of a module without an interface is used. #8924 - Make
rescript-tools migrateleave files untouched when no migration applies. #8922 - genType refers to values named like JS keywords or globals, such as
delete, by their JavaScript names. #8920 - Keep attributes and doc comments after
=in front of a record or..type, as intype t = @s.strict {...}, so that PPXs see them. #8919 - Keep inline records in exceptions and constructors multiline when the source breaks the line after
{. #8918 - Reanalyze no longer reports
Division_by_zerofor a non-zero literal divisor. #8917 - Make
rescript-tools migraterefuse files changed since the last build. #8916 - Warn about untagged variant payload patterns that a literal case makes unreachable, and accept
Yes | Ans(false)as exhaustive for@as(true) Yes | Ans(bool). #8914 - Fix the formatter dropping spreads, attributes and comments in array and list literals with spreads. #8905
- Fix a compiler crash on a guarded or-pattern that an earlier case makes unreachable. #8896
- Compile template and braced
%rawand%ffipayloads the same with and without PPXs. #8879 - Remove the temporary PPX files when a PPX fails or a build is interrupted. #8864
- Reject JSX props of an
@unboxedrecord type. #8857 - Fix the formatter indenting dict literal rows after a spread twice. #8853
- Fix the formatter dropping comments in dict patterns, variant spread patterns and dict literals with spreads. #8850
- Fix
module M = await (P: S)at the top level of a module compiling to a static import ofP. #8848 - Fix external PPXs changing dict literals and
Primitive_dict.make(...)calls. #8846 - Fix the formatter printing
awaiton a typed first-class module in a form that does not parse. #8845 - Fix JSX preserve mode passing a copy of the props instead of the props themselves for
<C {...props} />compiled to a call. #8844 - Fix a crash and wrong code for matches that test an optional field or dict key both for a value and for presence. #8842
rescript-rust: keep watching a source folder on Linux when an overlapping source folder is removed. #8839- Add the missing keys, such as
allowed-dependentsandfeatures, to therescript.jsonschema. #8835 - Derive module names from file names consistently, so that
Button.test.rescan referenceButton. #8797 - Fix the formatter printing escaped identifiers starting with
_in a form that does not parse. #8795 - Evaluate the arguments of an inlined call left to right, as the call does, including unused ones. #8786 #9177
- Fix a
@valglobal being read from a local binding of the same name. #8785 - Fix parser recovery and completion for a missing record or dict value, as in
{a: , b: 1}. #8779 - Fix generated JavaScript names colliding with identifiers containing
$. #8778 - Fix installing on Windows on ARM, broken since v12, by using the x64 binaries again. #8776
- Fix editor completion of values from modules included with
include await M. #8770 - Fix editor completion inside dict literals and dict patterns. #8770
- Report the required Node.js version 22 when the platform package can't be found. #8770
- Fix JSX preserve mode emitting JSX that means something other than the compiled call. #8754
- Fix exhaustiveness checks for dict patterns, and reject a key matched twice in one pattern. #8751
- Fix the formatter duplicating and dropping attributes on patterns. #8750
- Emit
"__proto__"keys in object literals as computed keys, so that they do not set the prototype. #8747 - Fix the formatter dropping attributes on dict literals and flattening nested dict spreads. #8746
- Give unused-pattern warnings for variant spreads a location. #8744
- Keep
@warning("-4")onifexpressions when formatting. #8741 - Fix the formatter dropping a
@res.ternaryattribute written in source. #8740 - Respect
@warningon the module inmodule type of. #8738 - Fix the formatter dropping attributes and
awaiton module expressions and printing invalid module constraints. #8735 - Fix the sign of
@inlinebigint constants in printed signatures. #8732 rescript-rust: fixwatchsometimes not exiting on macOS whenlib/watch.lockis removed. #8730- Keep parentheses around statements that start with a regexp literal when formatting. #8720
- Preserve the scope of attributes on ternary conditions when formatting. #8720
- Fix compiler crashes on
Someand optional arguments whose types come from a transitive dependency. #8719 - Fix switches on ints at the int32 limits; aliased int patterns such as
0xFFFF_FFFFand-1may now be reported as unused. #8717 - Fix
RescriptTools.binaryPathfailing withERR_PACKAGE_IMPORT_NOT_DEFINEDwhen used from a user project. #8694 - genType types inline-record cases of untagged variants as objects instead of their single field's type. #8693
- Fix invalid JavaScript for a module whose toplevel always throws. #8692
- Stop a long source path from shortening parts of module inclusion errors to
.... #8691 - Keep comments on labeled parameters with defaults and before
=?when formatting. #8690 rescript-rust: keep compiling independent modules after an unrelated failure. #8667- Keep watch mode running when a rebuild fails to initialize. #8641
- Make
rescript cleanwork with an invalid module graph and remove out-of-source outputs too. #8640 - Fix genType path resolution for Windows short paths and symlinked projects. #8639
rescript-rust: rebuild dependencies when the project's package output settings change. #8540
📝 Documentation
- State in the
rescript.jsonschema thatnamespace-entryrequiresnamespace. #8984
💅 Polish
- Stop describing
boolandunitas variants in coercion errors. #9218 - Name the wrong field in record and inline record coercion errors. #9205
- Point errors and editor features at the text of a template literal segment, without its backquotes,
${or}. #9166 - Clearer errors for an unknown deriver and for a configuration passed to
@deriving(accessors). #9157 - Compile large
let recgroups in linear time. #9153 - Stop storing a
Nonefor every omitted optional field, so that modules with many JSX DOM elements compile up to 10× faster. #9149 - Stop suggesting the
@uncurrydecorator in editor completion; the compiler no longer supports it. #9146 - Show a signature mismatch as the actual and expected declarations, limited to the items that differ. #9140
- Keep the location of extension constructors and exceptions declared in an interface. #9140
- Report every difference between the record fields or variant constructors of an implementation and its interface. #9133
- Indent multi-line types in error messages under their heading. #9091
- Stop mentioning switch branches in type errors after a
letthat destructures a GADT constructor. #9081 - Show GADT existential types as
$aand name the constructor that binds an escaping one. #9080 - Give the same
type rechint for every GADT constructor of a type declared withoutrec. #9079 - Print signature mismatch errors in ReScript syntax. #9078
- Add the missing JSX DOM event handlers through React 19.3. #9075
- Reuse one object per depth for nested
None, so that creating one no longer allocates. #9025 - Stop emitting bare conditions like
x === null;and emptyif/elsebranches. #9024 - Generate less code when matching
Some(x). #9022 - Allow
@notUndefinedon type abbreviations. #9017 - Generate smaller untagged variant switches that test literals and
typeofbefore anyinstanceof. #9015 #9046 #9047 - List floats and bigints in the error for an invalid
@aspayload, since@asaccepts them. #8987 - Put a blank line around multi-line top-level and module-level items when formatting. #8961
- Use constant arguments directly when inlining a function. #8942
- Import the default export for
@moduleexternals whose@scopestarts with"default". #8923 - Report a spread of the wrong collection type, such as a list spread into an array, at the spread. #8905
- Explain that a JSX tag needs a component module that defines
make. #8885 - Report unsupported JSX component annotation payloads; a payload on
@react.componentWithPropsis deprecated. #8884 #8944 - Treat
jsontemplate literals outside@as(json`...`) _as ordinary tagged templates. #8875 - Compile char range patterns as fast as a single char and show ranges in missing-case warnings. #8868 #8893
- Remove the
rescript/lib/es6/*andrescript/lib/js/*package exports, which pointed to missing files. #8837 - Stop inlining nested calls more than four levels deep, avoiding quadratic compile time and output size. #8801
- Speed up type checking of records with many fields. #8799
- Generate JavaScript for list literals that grows linearly with their length instead of quadratically. #8794
- Emit the imports of a module used both with and without
defaultin a stable order. #8787 - Speed up
rescriptbuilds by compiling modules in-process on several CPU cores. #8781 #8869 #9170 #9187 #9188 - Make
.cmtand.cmtifiles smaller by no longer embedding a copy of the.cmi. #8774 - Speed up dead code elimination of toplevel bindings in large modules. #8773
- Speed up compiling nested functions with local bindings named like JavaScript globals. #8772
- Speed up inlining decisions for large functions. #8771
- Make compilation slightly faster. #8769
- Compile dict spreads to object spread syntax instead of
Object.assign. #8747 - Name the
allowed-dependentskey in the hint for a dependency that is not allowed. #8696 - Require Node.js 22 in the platform binary packages. #8695
- Format
elsebranches consistently withifbranches. #8678 - Omit redundant braces around multi-statement switch case bodies when formatting. #8677
- Wrap JSX expression children and comments in braces when formatting, to prepare for literal text children. #8666
- Avoid running
rescript-schema-ppxandsury-ppxon source files without an@schemaannotation. #8662
🏠 Internal
- Require
lspbelow 1.28. #9234 - Dispatch
@derivingby name instead of through a registry that had a single deriver. #9157 - Remove stale CI steps. #9147
- Develop and test with Node.js 26. #9059
- Upgrade js_of_ocaml and wasm_of_ocaml to 6.5.0. #9051
- Build the dispatch of an untagged variant switch as a plan before printing it. #9045
- Upgrade the development toolchain and CI builds to OCaml 5.5.2. #9043
- Run the syntax roundtrip tests and format checks on Windows CI. #9042
- Run the remaining test suites on Windows CI. #9041
- Update vite to 8.3.5 in the dev playground. #9011
- Fix the cleanup of the concurrent async compiler request test. #8989
- Add
make test-rewatch-rustfor testing the Rust build system. #8983 - Document the rules of untagged variants in
compiler/ml/UntaggedVariants.md. #8952 - Recognize stdlib classes in untagged variants only through their
@instanceOfannotations. #8950 - Publish API documentation to the website branch matching the compiler major. #8945
- Update Binaryen to 133 in CI and pin the remaining unpinned actions. #8913
- Remove the hashing fast paths for switches with many distinct constants, which char ranges no longer need. #8900
- Remove the error variant catalog
tests/ERROR_VARIANTS.md. #8898 - Update Yarn, mocha, Biome and other development dependencies. #8890
- Upgrade opam to 2.6.1 in the devcontainer. #8889
- Build the OCaml build system against libuv 1.53.0 via the rescript-lang/luv fork. #8883
- Make compiler requests safe to run repeatedly and in parallel in one process. #8864
- Fix spurious failures when updating the super_errors snapshots. #8840
- Add and fix tests for reanalyze, the formatter,
rescript-tools migrateand the build test fixtures. #8838 #8855 #8856 - Run the TypeScript type check of the JS sources in CI. #8836
- Fix stale comments and docs. #8835 #8841 #8851 #8854
- Remove the S-expression parsetree printer (
res_parser -print sexp). #8803 - Use one set of OCaml warning flags for the whole repository. #8796
- Use the OCaml standard library's hash tables, sets and maps in the compiler. #8786 #8787 #8789 #8790
- Remove the compiler's own growable vector (
Vec) in favor of plain arrays. #8784 - Make
dictan abstract type instead of a record with a hidden field. #8752 - Remove the unused
res.ifletencoding ofif let. #8741 - Merge the formatter's internal attribute filters into one. #8740
- Remove dead code and OCaml leftovers across the compiler, editor analysis, reanalyze, genType and rewatch. #8731 #8756 #8793 #8805 #8849 #8852 #8859 #8991 #9146
- Remove unused parsetree nodes and make expression attributes immutable. #8682 #8684 #8685
- Replace parsetree attribute encodings, such as for ternaries, dicts and spreads, with dedicated nodes. #8674 #8678 #8686 #8738 #8742 #8746 #8749 #8751 #8875 #8879 #8884 #8905 #9161
- Add before/after optimization views to the developer playground's Lambda tab. #8636