Tags:
- 💥 [Breaking Change]
- 👓 [Spec Compliance]
- 🚀 [New Feature]
- 🐛 [Bug Fix]
- 📝 [Documentation]
- 🏠 [Internal]
- 💅 [Polish]
- AST cleanup: use inline record for Pexp_fun. #7213
- Add all standard CSS properties to
JsxDOMStyle
. #7205
- Add
Option.all
&Result.all
helpers. #7181 - Add
@react.componentWithProps
for React component functions taking a props record instead of labeled arguments. #7203
- Fix exponential notation syntax. #7174
- Fix bug where a ref assignment is moved ouside a conditional. #7176
- Fix nullable to opt conversion. #7193
- Raise error when defining external React components with
@react.componentWithProps
. #7217
- Use latest compiler for tests. #7186
- Added infra to modernise AST: theres' Parsetree, Parsetree0 (legacy), and conversion functions to keep compatibility with PPX. #7185
- AST cleanup: remove exp object and exp unreachable. #7189
- AST cleanup: explicit representation for optional record fields in types. #7190 #7191
- AST cleanup: first-class expression and patterns for records with optional fields. #7192
- AST cleanup: Represent the arity of uncurried function definitions directly in the AST. #7197
- AST cleanup: Remove Pexp_function from the AST. #7198
- Remove unused code from Location and Rescript_cpp modules. #7150
- Build with OCaml 5.2.1. #7201
- AST cleanup: Remove
Function$
entirely for function definitions. #7200 - AST cleanup: store arity in function type. #7195
- AST cleanup: remove explicit uses of
function$
in preparation for removing the type entirely. #7206 - AST cleanup: remove
function$
entirely. #7208
- Introduce "Unified operators" for arithmetic operators (
+
,-
,*
,/
,mod
). #7057 - Add remainder (
%
, aka modulus) operator. #7152
- Fix and clean up boolean and/or optimizations. #7134 #7151
- Fix identifiers with name
arguments
andeval
to be mangled. #7163
- Improve code generation for pattern matching of untagged variants. #7128
- Improve negation handling in combination with and/or to simplify generated code (especially coming out of pattern matching). #7138
- Optimize JavaScript code generation by using
x == null
checks and improving type-based optimizations for string/number literals. #7141 - Improve pattern matching on optional fields. #7143 #7144
- Optimize compilation of switch statements for untagged variants when there are no literal cases. #7135
- Further improve boolean optimizations. #7149
- Simplify code generated for conditionals. #7151
- Move rescript-editor-analysis and rescript-tools into compiler repo. #7000
- OCaml compatibility in the stdlib and primitives are dropped/deprecated. #6984
- Remove JSX v3. #7072
- Remove js_cast.res. #7075
- Use FORCE_COLOR environmental variable to force colorized output. #7033
- Allow spreads of variants in patterns (
| ...someVariant as v =>
) when the variant spread is a subtype of the variant matched on. #6721 - Fix the issue where dynamic imports are not working for function-defined externals. #7060
- Allow pattern matching on dicts.
switch someDict { | dict{"one": 1} => Js.log("one is one") }
. #7059 - "ReScript Core" standard library is now included in the
rescript
npm package. #7108 #7116 - Handle absolute filepaths in gentype. #7104
- Fix tuple coercion. #7024
- Fix attribute printing. #7025
- Fix "rescript format" with many files. #7081
- Fix bigint max, min. #7088
- Fix parsing issue with nested variant pattern type spreads. #7080
- Fix JSX settings inheritance: only 'version' propagates to dependencies, preserving their 'mode' and 'module'. #7094
- Fix variant cast to int. #7058
- Fix comments formatted away in function without arguments. #7095
- Fix genType JSX component compilation. #7107
- Add some context to error message for unused variables. #7050
- Improve error message when passing
children
prop to a component that doesn't accept it. #7044 - Improve error messages for pattern matching on option vs non-option, and vice versa. #7035
- Improve bigint literal comparison. #7029
- Improve output of
@variadic
bindings. #7030 - Improve error messages around JSX components. #7038
- Improve output of record copying. #7043
- Provide additional context in error message when
unit
is expected. #7045 - Improve error message when passing an object where a record is expected. #7101
- Remove uncurried flag from bsb. #7049
- Build runtime/stdlib files with rescript/bsb instead of ninja.js. #7063
- Build tests with bsb and move them out of jscomp. #7068
- Run
build_tests
on Windows. #7065 - Rename folder "jscomp" to "compiler". #7086
- Disable -bs-cross-module-opt for tests. #7071
- Move
ounit_tests
into thetests
folder. #7096 - Move
syntax_tests
into thetests
folder. #7090 #7097 - Capitalize runtime filenames. #7110
- Build mocha tests as esmodule / .mjs. #7115
- Use dict instead of Dict.t everywhere. #7136
- Revert "Throws an instance of JavaScript's
new Error()
and adds the extension payload forcause
option" (#6611). #7016 - Fix dict literals error. #7019
- Allow coercing polyvariants to variants when we can guarantee that the runtime representation matches. #6981
- Add new dict literal syntax (
dict{"foo": "bar"}
). #6774 - Optimize usage of the new dict literal syntax to emit an actual JS object literal. #6538
- Fix issue where long layout break added a trailing comma in partial application
...
. #6949 - Fix incorrect format of function under unary operator. #6953
- Fix incorrect printing of module binding with signature. #6963
- Fix incorrect printing of external with
@as
attribute and_
placholder (fixed argument). #6970 - Disallow spreading anything but regular variants inside of other variants. #6980
- Fix comment removed when function signature has
type
keyword. #6997 - Fix parse error on doc comment before "and" in type def. #7001
- Add dev container. #6962
- Convert more tests to the node test runner. #6956
- Remove attribute "internal.arity". #7004
- Remove dead modules. #7008
- Improve formatting in the generated js code. #6932
}\ncatch{
->} catch {
for(let i = 0 ,i_finish = r.length; i < i_finish; ++i){
->for (let i = 0, i_finish = r.length; i < i_finish; ++i) {
while(true) {
->while (true) {
- Fixed tabulation for
switch case
bodies - Fixed tabulation for
throw new Error
bodies - Removed empty line at the end of
switch
statement - Removed empty
default
case fromswitch
statement in the generated code
- Optimised the Type Extension runtime code and removed trailing
/1
fromRE_EXN_ID
. #6958 - Compact output for anonymous functions. #6945 #7013
- Rewatch 1.0.9. #7010
- Allow
@directive
on functions for emitting function level directive code (let serverAction = @directive("'use server'") (~name) => {...}
). #6756 - Add
rewatch
to the npm package as an alternative build tool. #6762 - Throws an instance of JavaScript's
new Error()
and adds the extension payload forcause
option. #6611 - Allow free vars in types for type coercion
e :> t
. #6828 - Allow
private
in with constraints. #6843 - Add regex literals as syntax sugar for
@bs.re
. #6776 - Improved mechanism to determine arity of externals, which is consistent however the type is written. #6874 #6881 #6883
- Add
Js.globalThis
object binding. #6909
- Make
j
andjs
allowed names for tag functions. #6817 lazy
syntax is no longer supported. If you're using it, useLazy
module orReact.lazy_
instead. #6342- Remove handling of attributes with
bs.
prefix (@bs.as
->@as
etc.). #6643 - Remove obsolete
@bs.open
feature. #6629 - Drop Node.js version <18 support, due to it reaching End-of-Life. #6429
- Remove deprecated -bs-super-errors option. #6814
- Some global names and old keywords are no longer prefixed. #6831
- Remove ml parsing tests and conversion from
.ml
to.res
via format. #6848 - Remove support for compiling
.ml
files, and general cleanup. #6852 - Remove
rescript convert
subcommand. #6860 - Remove support for
@bs.send.pipe
. This also removes all functions inJs_typed_array
that rely on@bs.send.pipe
. #6858 #6891 - Remove deprecated
Js.Vector
andJs.List
. #6900 - Remove support for
%time
extension. #6924 - Remove
caml_external_polyfill
module and the related behavior. #6925
- Fix unhandled cases for exotic idents (allow to use exotic PascalCased identifiers for types). #6777 #6779 #6897
- Fix unused attribute check for
@as
. #6795 - Reactivate unused attribute check for
@int
. #6802 - Fix issue where using partial application
...
can generate code that usesCurry
at runtime. #6872 - Avoid generation of
Curry
with reverse application|>
. #6876 - Fix issue where the internal ppx for pipe
->
would not use uncurried application in uncurried mode. #6878
- Build with OCaml 5.2.0. #6797
- Convert OCaml codebase to snake case style. #6702
- Fix
-nostdlib
internal compiler option. #6824 - Remove a number of ast nodes never populated by the .res parser, and resulting dead code. #6830
- Remove coercion with 2 types from internal representation. Coercion
e : t1 :> t2
was only supported in.ml
syntax and never by the.res
parser. #6829 - Convert
caml_format
andjs_math
to.res
. #6834 - Convert
js.ml
files to.res
. #6835 - Remove old
.ml
tests. #6847 - Make compiler libs ready for uncurried mode. #6861
- Make tests ready for uncurried mode. #6862
- Make gentype tests uncurried. #6866
- Remove
@@uncurried.swap
, which was used for internal tests. #6875 - Build the compiler libraries/tests in uncurried mode. #6864
- Ignore
-uncurried
command-line flag. #6885 - Cleanup: remove tracking of uncurried state in parser/printer. #6888
- Remove
%opaque
primitive. #6892 - Reunify JsxC/JsxU -> Jsx etc. #6895
- Remove the transformation of
foo(1,2)
intoJs.Internal.opaqueFullApply(Internal.opaque(f), 1, 2)
, and change the back-end to treat all applications as uncurried. #6893 - Remove
@uncurry
from ReScript sources (others, tests). #6938 - Remove leftover uncurried handling. #6939 #6940
- Start converting tests from mocha to the node test runner. #6956
- Make the
--help
arg be prioritized in the CLI, so correctly prints help message and skip other commands. #6667 - Remove redundant space for empty return in generated js code. #6745
- Remove redundant space for export in generated js code. #6560
- Remove redundant space after continue in generated js code. #6743
- Remove empty export blocks in generated js code. #6744
- Fix indent for returned/thrown/wrapped in parentheses objects in generated js code. #6746
- Fix indent in generated js code. #6747
- In generated code, use
let
instead ofvar
. #6102 - Turn off transformation for closures inside loops when capturing loop variables, now that
let
is emitted instead ofvar
. #6480 - Improve unused attribute warning message. #6787
- Remove internal option
use-stdlib
from build schema. #6778 - Fix
Js.Types.JSBigInt
payload to use nativebigint
type. #6911 - Deprecate
%external
extension, which has never been officially introduced. #6906 - Deprecate
xxxU
functions in Belt. #6941 - Improve error messages for function arity errors. #6990
- Add missing HTML attribute capture to JsxDOM.res. #7006
- Fix tag function location on compiler error. #6816
- Fix Deno compatibility issues on Windows. #6850
- Fix issue with infinite loops with type errors on recursive types. #6867
- Ignore
@uncurry
attribute in uncurried mode, to avoid generating calls toCurry
at runtime. #6869 - Avoid generating calls to Curry when adjusting arity of uncurried functions. #6870
- Fix build after calling without
-warn-error
, see #6868 for more details. #6877 - Fix issue with uninitialized
_param
in recursive functions with unit argument. #6907
- Omit standard library dir from load path if -nostdlib is set. #6833
- Fix issue where capitalised type variables were only allowed in certain positions. #6820
- Support Windows 11 ARM (using the x64 binaries in emulation). #6813
- Fix location of let bindings with attributes. #6791
- PPX v4: mark props type in externals as
@live
to avoid dead code warnings for prop fields in the editor tooling. #6796 - Fix issue where optional labels were not taken into account when disambiguating record value construction. #6798
- Fix issue in gentype when type
Jsx.element
surfaces to the user. #6808 - Fix inclusion check (impl vs interface) for untagged variants, and fix the outcome printer to show tags. #6669
- Fix encoding inside tagged template literals. #6810
- Fix issue of incorrect switch cases with identical bodies when mixing object and array. #6792
- Fix formatter eats comments on the first argument of a uncurried function. #6763
- Fix formatter removes parens in pipe operator with anonymous uncurried function. #6766
- Revert escape JSX prop names with hyphens (#6705). #6731
- Add
%todo
extension for leaving implementation for later. #6713 - Add
-warn-error
argument for generating errors in CI. Useful for%todo
extension. #6717
- Improve error when using
@deriving(accessors)
on a variant with record arguments. #6712 - Stop escaping JSX prop names with hyphens. #6705
- Fix trailing undefined for optional parameters not omitted with
@send
and@new
. #6716 - Fix JSX4 adding the incorrect type annotation for the prop
ref
inReact.forwardRef
component. #6718 - Fix description for warning number 110. #6725
- Module spec
es6
andes6-global
is deprecated in favor ofesmodule
. #6709
- Fix variance setting for builtin
dict
type. Fixes issues around inference. #6707
- Fix mishandling of uncurried functions in super errors. #6694
- Fix misparsing in/after JSX. #6686
- Fix
@deriving(accessors)
outputting curried functions in uncurried mode. #6687
- Fix emitting static import instead of dynamic import. #6664
- Fix local type variables breaking react components. #6665
- Fix remove redundant branches in generated switch body. #6672
- Fix issue in partial application when the last named arg is provided. #6681
- Omit
undefined
in external function calls for trailing optional arguments when not supplied. #6653 - Make pattern match suggestions to be easier to copy-paste. #6656
- No parens around tagged template literals. #6639
- Allow identifier with modules in tagged template literals (e.g. Pg.sql
select * from ${table} where id = ${id}
). #6645
- Fix compiler crash when reexporting tagged template literal externals. #6645
- Add support for array spread. #6608
- Support import attributes (https://github.com/tc39/proposal-import-attributes) in
@module()
. #6599 - allow hyphens in jsx tag names (e.g.
<mj-column>
). #6609
- Fix issue with async and newtype in uncurried mode. #6601
- Generic JSX transform: Rename expected module name for lowercase JSX to
Elements
fromDOM
. #6606 - Generic JSX transform: Set default config params for
jsxConfig
. #6606 - Generic JSX transform: Handle namespaced names. #6606
- Fix issue with doc comment in recursive module. #6613
- Fix issue with Exceptions and Extensible types runtime generation. #6570
- Fix inline comment before spread syntax in record. #6615
- Use OCaml 4.14.1 (+ Alpine 3.19 container) for CI build. #6600
- Experimental support of tagged template literals, e.g.
sql`select * from ${table}
. #6250 - Experimental support for generic/custom JSX transforms. #6565
dict
is now a builtin type. #6590
- GenType: distinguish inline records from unary variant cases of object type. #6586
- Renamed inline record fields: fix renamed field access in inline records. #6551
- Fixed issue with coercions sometimes raising a
Not_found
instead of giving a proper error message. #6574 - Fix issue with recursive modules and uncurried. #6575
- Improve error message for missing label(s) in function application. #6576
No changes compared to rc.9.
- GenType: support
@deriving(accessors)
outputs. #6537 - Allow coercing ints and floats to unboxed variants that have a catch-all unboxed int or float case. #6540
- Allow tuples in untagged variants. #6550
- GenType: now emits full suffix on JS import path to be compatible with
.res.js
. #6541
- Add support for type coercion for invariant type arguments such as array payloads. #6518
- Start treating
rescript
command the same as therescript build
command, so now you can dorescript -w
. #6524
- Fix accidental removal of
Belt.Result.Ok
andBelt.Result.Error
constructors in rc.5. #6514 - Add missing check that the runtime representation of variants matches implementation and interface. https://github.com/rescript-lang/rescript-compiler/pull/6513/files
- GenType: only export types (not values) from module types. #6516
- Fix compiler crash with unboxed variant definition with only 1 constructor. #6523
- GenType: support mutual recursive types inside modules. #6528
- Workaround for
@as
in labels in uncurried externals, which was broken. #6527
- GenType: make outputs DCE-friendly. #6508
- Allow empty inline records in variants. #6494
- Allow empty record patterns in pattern matching. #6494
- Fix issue where an inline record with attributes did not parse. #6499
- Fix issue with uncurried function with 1 arg being a variable where an undefined variable could be emitted. #6507
- Fix runtime errors on
@genType.as("alias")
output. #6509
- Freely configurable suffix for generated .js files. #6472
- Fix issue with GenType and
result
introduced in rc.5. #6464 - Fix compiler crash when inlining complex constants in pattern matching. #6471
- Fix issue with generating async functions inside loops. #6479
- Fix issue with Gentype and string annotations with numbers such as
@as("0")
. #6487 - Fix error message on curried/uncurried signature mismatch. #6414
- Improve some error messages in rescript.conf parsing. #6469
- Allow coercing unboxed variants with only strings (now including with a single payload of string) to the primitive string. #6441
- Allow coercing strings to unboxed variants that have a catch-all unboxed string case. #6443
- Allow coercing
int
tofloat
. #6448
- Fix issue with dynamic import of module in nested expressions. #6431
- Fix issue where GenType was not supporting
@tag
on ordinary variants. #6437 - Fix using dynamic import of module in block instead of async function. #6434
- Fix issue with using dynamic import of module in uncurried mode. #6434
- Fix build error with JSX v4 transformation of React.forwardRef in uncurried mode. #6447
- Fix printing of exotic JSX names. #6451
- Fix locations when code with
await
fails to compile (all locations would point to the internal functionunsafe_await
). #6452 - Fix renaming fields (with @as) in inline records doesn't work when destructuring. #6456
- Fix
rc.4
regressions:
- Remove dependency stdlib-406 -> belt. #6453
- Playground: Add support for implicitly opened modules. #6446
- Add
Deno
to reserved names, so that modules namedDeno
don't clash with the globally exposedDeno
object. #6428 - Disable ESLint/TSLint on gentype outputs properly. #6442
- Improve
rescript
CLI to usestdout
/stderr
appropriately for help command's message. #6439 - Generate
f()
instead off(undefined)
forf()
. #6459
- Support renaming fields in inline records with
@as
attribute. #6391 - Support renaming object fields of
@obj
external ppx with@as
attribute. #6391 - Add builtin abstract types for File and Blob APIs. #6383
- Untagged variants: Support
promise
, RegExes, Dates, File and Blob. #6383 - Untagged variants: Support
bool
. #6368 - Support aliased types as payloads to untagged variants. #6394
- Support the async component for React Server Component in JSX V4. #6399
- Support
rescript.json
configuration file and deprecatebsconfig.json
. #6382
- Update watcher rules to recompile only on config and
*.res
/*.resi
/*.ml
/.mli
file changes. Solves the issue of unnecessary recompiles on.css
,.ts
, and other unrelated file changes. #6420 - Add smart printer for pipe chains. #6411 (the formatter will reformat existing code in certain cases)
Js.Json.t
now usesBoolean(bool)
instead of explicit@as(true) True | @as(false) False
. #6421
- Fix issue with GenType and labelled arguments. #6406
- Fix dependencies reinitialization on every change in watch mode. Leads to faster rebuilds and cleaner terminal. #6404
- A little performance improvement for JSX V4 runtime helper by removing one object allocation for components with key prop. #6376
- The error message for "toplevel expressions should evaluate to unit" has been revamped and improved. #6407
- Improve "Somewhere wanted" error messages by changing wording and adding more context + suggested solutions to the error messages where appropriate. #6410
- Display the compile time for
rescript build
command. #6404 - Improve help message for
build
andclean
commands. #6404 - Pass through the
-verbose
flag to builds in watch mode. #6404 - Improve error message when defining duplicate labels in a record. #6415
- Improve error message when trying to concatenate strings using the wrong operator. #6416
- Fix issue with JSX V4 when component props have the default value with same name. #6377
- Fixed code formatter with
"uncurried": false
in bsconfig. #6378
- Add
Bun
to reserved names, so that modules namedBun
don't clash with the globally exposedBun
object. #6381
rescript build
will always build its dependency by default. The argument-with-deps
is not needed anymore. #6350
- Stop mangling object field names. If you had objects with field names containing "__" or leading "_", they won't be mangled in the compiled JavaScript and represented as it is without changes. #6354
- Fixed outcome printer resolution of uncurried config. #6353
- GenType: Propagate comments from record fields to emitted TypeScript types. #6333
$$default
is no longer exported from the generated JavaScript when using default exports. #6328
- Conditionally print error message about record with missing label potentially being a component. #6337
- Put definition in the bottom and the actual error at the top when reporting errors for supplying fields etc with the wrong name. #6336
- Fix left over places where polyvariant tag names were printed in OCaml syntax instead of ReScript. #6348
- Variants: Allow coercing from variant to variant where applicable. #6314
- Variants: Experimental support for spreading variant type definitions to copy constructors from one variant to another. #6316
- Fixed name collision between the newly defined Js.Json.t and the variant constructor in the existing Js.Json.kind type. To address this, the usage of the existing Js.Json.kind type can be updated to Js.Json.Kind.t. #6317
- Fixed outcome printing of uncurried higher order function types. #6323
- Fixed printing of type constraints in template literal substitutions. #6324
- Untagged variants: consider regexp as an object type. #6296
- Semantic-based optimization of code generated for untagged variants. #6108
- Record type spreads: Allow using type variables in type spreads. Both uninstantiated and instantiated ones. #6309
- Variants: Allow coercing variants to string/int/float when applicable. #6311
- Fix issue with dynamic import of modules in expressions. #6310
- Introduced a new
%ffi
extension (experimental - not for production use!) that provides a more robust mechanism for JavaScript function interoperation by considering function arity in type constraints. This enhancement improves safety when dealing with JavaScript functions by enforcing type constraints based on the arity of the function. #6251 - Extended untagged variants with function types. #6279
- Remove rudimentary node bindings and undocumented
%node
extension. #6285
- Fix issue where uncurried type internals leak in type error. #6264
- Improve error messages for untagged variant definition. #6290
- Fix type checking performance issue for large records. #6289
- Make uncurried mode opt-out: by default, every project is now in uncurried mode, unless
"uncurried": false
is specified in the project config. #6249
- Removed duplicate Super_error implementation in syntax. #6246
- Fix issue with inlining records in the presence of record coercion. #6256
-bs-super-errors
flag has been deprecated along with Super_errors. #6243@rescript/react
>= 0.12.0-alpha.2 is now required because of the React.fragment's children type fix. #6238
- Remove unnecessary require and import statements when using dynamic imports. #6232
- Fix option unboxing logic in the presence of untagged variants. #6233
- Fix printing of local module with type. #6212
- Adapting JSX4 to React.fragment's children type change (
'children
->React.element
) #6238
- In uncurried mode, outcome printer swaps curried and uncurries function printing compared to legacy.
- Add location information to duplicate type definition error messages. #6199
- Replace normal module errors with Super_error module, and clean up Super_error. #6199
Js.Json.t
,Js.null
andJs.nullable
are now untagged variants representing their runtime values, instead of abstract types. #6218
- Add support for Dynamic import. #5703
- GenType: Add
moduleResolution
option to customize extensions on emitted import statements. This helps to adjust output compatibility with TypeScript projects using ESM. #6182node
(default): Drop extensions.node16
: Use TS output's extensions. Make it ESM-compatible.bundler
: Use TS input's extensions. Make it ESM-compatible.
- Make untagged variants understand payloads defined as records. #6208
- Parse
assert
as a regular function.assert
is no longer a unary expression. Example: beforeassert 1 == 2
is parsed as(assert 1) == 2
, now it is parsed asassert(1 == 2)
. #6180
- Make "rescript format" work with node 10 again and set minimum required node version to 10 in package.json. #6186
- Fix partial application for uncurried functions with labeled args #6198
- Add error messages for dangling doc comments/attributes and mutable in record type definition. #6206
- Fix issue with overlapping array and object in untagged variants #6219
- Add surface syntax for partial application of uncurried functions:
foo(1, ...)
. This corresponds to curried application in the old mode. #6166
- Fix broken formatting in uncurried mode for functions with _ placeholder args. #6148
- Fix issue where spreading record types with optional labels would not have their labels preserved as optional. #6154
- Fix error location to be the type with the spreads when spreading record types with duplicate labels. #6157
- Disable warning on
@inline
attibute on uncurried functions. #6152 - Support doc comments on arguments of function types. #6161
- Fix issue with record type coercion and unboxed. #6158
- Fixed subtype checking for record types with "@as" attributes: The subtype relationship now takes into account the compatibility of "@as" attributes between corresponding fields, ensuring correctness in runtime representation. #6158
- Emit directive above header comment. #6172
- Add error message to private extension. #6175
- Add support for extensible records (e.g.
type t = {...t1, x:int, ...t2}
) #5715
- Fix formatting and parentheses placement in uncurried functions with constraints. #6143
- Add support for type coercion
:>
for records. #5721
- Special case generation of uncurried functions with 1 argument of unit type so they don't take a parameter. #6131
- Introduce experimental uncurried mode. For experimentation only. PR #5796
- Customization of runtime representation of variants and introduction of untagged variants PR #6095, PR #6103
- Add support for uncurried mode: a mode where everything is considered uncurried, whether with or without the
.
. This can be turned on with@@uncurried
locally in a file. For project-level configuration inbsconfig.json
, there's a boolean config"uncurried"
, which propagates to dependencies, to turn on uncurried mode. Since there's no syntax for partial application in this new mode, introduce@res.partial foo(x)
to express partial application. This is temporary and will later have some surface syntax. Make uncurried functions a subtype of curried functions, and allow application for uncurried functions. Themake
function of components is generated as an uncurried function. Use best effort to determine the config when formatting a file. #5968 #6080 #6086 #6087 - Customization of runtime representation of variants. This is work in progress. E.g. some restrictions on the input. See comments of the form "TODO: put restriction on the variant definitions allowed, to make sure this never happens". #6095
- Introduce untagged variants #6103
- Add support for unary uncurried pipe in uncurried mode #5804
- Add support for partial application of uncurried functions: with uncurried application one can provide a subset of the arguments, and return a curried type with the remaining ones #5805
- Add support for uncurried externals #5815 #5819 #5830 #5894
- Parser/Printer: unify uncurried functions of arity 0, and of arity 1 taking unit. There's now only arity 1 in the source language. #5825
- Add support for default arguments in uncurried functions #5835
- Inline uncurried application when it is safe #5847
- Support optional named arguments without a final unit in uncurried functions #5907
- GenType: add the option to use the
@genType
annotation at the module level, meaning that all the items in the module should be exported. #6113 - GenType: add support for
@genType
annotations on module definitions. #6113 - Prebuilt binaries are now provided for all major platforms:
- macOS x64
- macOS ARM
- Linux x64 (statically linked)
- Linux ARM (statically linked)
- Windows x64
- Remove support for the legacy Reason syntax. Existing Reason code can be converted to ReScript syntax using ReScript 9 as follows:
npm i -g rescript@9
rescript convert <reason files>
- Remove obsolete built-in project templates and the "rescript init" functionality. This is replaced by create-rescript-app which is maintained separately.
- Do not attempt to build ReScript from source on npm postinstall for platforms without prebuilt binaries anymore.
- Made pinned dependencies transitive: if a is a pinned dependency of b and b is a pinned dependency of c, then a is implicitly a pinned dependency of c. This change is only breaking if your build process assumes non-transitivity.
- Curried after uncurried is not fused anymore:
(. x) => y => 3
is not equivalent to(. x, y) => 3
anymore. It's instead equivalent to(. x) => { y => 3 }
. Also,(. int) => string => bool
is not equivalen to(. int, string) => bool
anymore. These are only breaking changes for unformatted code. - Exponentiation operator
**
is now right-associative.2. ** 3. ** 2.
now compile toMath.pow(2, Math.pow(3, 2))
and not anymoreMath.pow(Math.pow(2, 3), 2)
. Parentheses can be used to change precedence. - Remove unsafe
j`$(a)$(b)`
interpolation deprecated in compiler version 10 #6068 - Remove deprecated module
Printexc
@deriving(jsConverter)
not supported anymore for variant types #6088- New representation for variants, where the tag is a string instead of a number. #6088
- GenType: removed support for
@genType.as
for records and variants which has become unnecessary. Use the language's@as
instead to channge the runtime representation without requiring any runtime conversion during FFI. #6099 #6101
- Fix issue where uncurried was not supported with pipe #5803
- Fix printing of nested types in uncurried mode #5826
- Fix issue in printing uncurried callbacks #5828
- Fix formatting uncurried functions with attributes #5829
- Fix parsing/printing uncurried functions with type parameters #5849
- Fix compiler ppx issue when combining
async
and uncurried application #5856 - Fix issue where the internal representation of uncurried types would leak when a non-function is applied in a curried way #5892
- Fix some comments disappearing in array access expressions #5947
- Parser: fix location of variable when function definition
{v => ...}
is enclosed in braces #5949 - Fix issue with error messages for uncurried functions where expected and given type were swapped #5973
- Fix issue with integer overflow check #6028
- Make internal encoding of locations aware of unicode #6073
- Fix issue where
foo(x,_)
in uncurried mode would generate a curried function #6082 - Fix printing of uncurried application when the lhs is a function definition #6084
- Fix parsing uncurried type starting with path #6089
- Fix bigInt comparison #6097
- Fixed a bug where the async attribute was not preserved when using the
@this
decorator in ReScript functions. This fix allows proper handling of async functions with the@this
decorator. Issue: #6100 - Fix issue with GenType and module aliases #6112
- Syntax: process uncurried types explicitly in the parser/printer #5784 #5822
- Syntax: process uncurried function declarations explicitly in the parser/printer #5794
- PPX V4: allow uncurried
make
function and treat it like a curried one #5802 #5808 #5812 - Remove processing of objects expressions, which don't exist in
.res
syntax (Pexp_object
) #5841 - Remove class type processing from compiler ppx #5842
- Remove method application via operator
##
, which does not exist in.res
syntax #5844 - Treat
@meth
annotation as making the type uncurried for backwards compatibitly with some examples #5845 - Process
@set
annotation for field update as generating an uncurried function #5846 - Treat uncurried application of primitives like curried application, which produces better output #5851
- New internal representation for uncurried functions using built-in type
function$<fun_type, arity>
this avoids having to declare all the possible arities ahead of time #5870 - PPX V3: allow uncurried
make
function and treat it like a curried one #6081 - Add support for
|>
in uncurried mode by desugaring it #6083 - Change the compilation of pattern matching for variants so it does not depends on variats being integers #6085
- Improve code generated for string templates #6090
- Move Jsx and JsxDOM and JsxEvent and JsxPPXReactSupport inside Pervasives and build them separately for curried and uncurried mode #6091
- Gentype: allow recursive data types rescript-association/genType#585
- Fix implementation of directives #6052
- Fix issue if the
lib
dir is included in the sources of bsconfig.json #6055 - Fix issue with string escape in pattern match #6062
- Fix issue with literal comparison of string constants #6065
- Add support for toplevel
await
#6054
- Better error message for extension point #6057
- Improve format check help #6056
- Deprecate unsafe
j`$(a)$(b)`
interpolation: use string templates`${a}${b}`
instead #6067
- Add experimental suppport for directives. An annotation such as
@@directive("use client;")
emitsuse client;
verbatim before imports #5999 genType
: addCore
standard library support for the following builtin types:Null.t
,Nullable.t
,Undefined.t
,Dict.t<_>
,Promise.t<_>
,Date.t
,BigInt.t
,RegExp.t
,Map.t<_, _>
,WeakMap.t<_, _>
,Set<_>
,WeakSet<_>
#6024
genType
: streamline the treatment of optionals as undefined #6024- Represent
option<t>
asundefined | t
instead ofnull | undefined | t
. This is more permissive when importing functions taking optional values (allows to use option types), but stricter when e.g. exporting ReScript functions taking arguments of option type. Fallback: useJs.undefined<_>
instead. - Represent
{x:option<string>}
as{x:(undefined | string)}
instead of{x?: string}
. This is more in line with TS's behaviour. Fallback: use{x?:string}
.
- Represent
- Add the gap property to jsxDOMStyle #5956
- Fix issue where error messages related to non-existent props were displayed without location information rescript-lang/syntax#730
- Fix issue where uncurried functions were incorrectly converting the type of a prop given as a default value to curried rescript-lang/syntax#731
- Fix issue with nested async functions, where the inner function would be emitted without
async
#5984 - Fix issue with printing async functions with locally abstract types rescript-lang/syntax#732
- Fix issue with async context and locally abstract types #5985
- Fix support for recursive components in JSX V4 rescript-lang/syntax#733
- GenType: fix issue with V3 compatibility mode (see #5990) #5992
- Fix issue with overlapping labelled argument with default value rescript-lang/syntax#734
- Fix issue with using alias and default value together rescript-lang/syntax#734
- Fix issue in
Js.Promise2
wherethen
andcatch
were returningundefined
#5996 - Fix issue in the compiler back-end where async functions passed to an
@uncurry
external would be inlined and transformed in a way that loses async #6011 - Fix location issue for the treatment of
async
functions where hovering on the body with a type error would show'a => promise<'a>
everywhere #6014 - Fix formatting of
switch
expressions that contain bracedcases
inside rescript-lang/syntax#735 - Fix formatting of props spread for multiline JSX expression rescript-lang/syntax#736
- Support
@gentype.import
as an alias to@genType.import
in the compiler #6021 - In GenType, check annotations also in module types to decide whether to produce the
.gen.tsx
file #5903 - Fix issue with JSX V4 and newtype rescript-lang/syntax#737
- Fix issue with JSX V4 when components are nested rescript-lang/syntax#738
- Fix issue where generic compare on
float
values would be different from the compare for typefloat
#6043 - Improve code generated for default arguments in JSX V4 rescript-lang/syntax#739
- Fix issue with JSX V4 props of the form
~p as module(...)
rescript-lang/syntax#739
- Fix an issue where error messages related to duplicate props were displayed without a loc and were unclear rescript-lang/syntax#728
- Parse the attributes of labelled argument to the pattern attributes of argument instead of function. rescript-lang/syntax#722
- The prop names duplicated to keyword are not mangled automatically in JSX v4.
- Use
@as
instead
- Use
- Add support for empty inlined record literal
{}
for inlined records where all fields are optional #5900
- Prevent inlining of async functions in additional cases #5860
- Fix build error where aliasing arguments to
_
in the make function with JSX V4. #5881 - Fix parsing of spread props as an expression in JSX V4 #5885
- Fix dropping attributes from props in make function in JSX V4 #5905
- Fix issue where no error was reported when ? was used for non-optional fields. #5853
- Fix issue where optional fields in inline records were not supported and would cause type errors #5827
- Prevent inlining of async functions in last stage of the compiler when the functions are not exported (not in interface file or shadowed) #5790
- Support format check with
rescript format -check
. #5760
- Fix issue where the last line of
rescript format --help
usage was being swallowed #5760 - Specialize the printing of the rhs of a record field assignment for optional values
{x: ? e}
rescript-lang/syntax#714
- Support the use of spread anywhere in list creation (e.g.
list{...x, 1, ...y, ...z}
). rescript-lang/syntax#692 - Add support for the argument of
@react.component
to set a props type from the outside. rescript-lang/syntax#699
- Fix issue where the JSX key type is not an optional string rescript-lang/syntax#693
- Prevent inlining of async functions #5754
- Fix build error for JSX fragment without children rescript-lang/syntax#704
- Fix issue where async as an id cannot be used with application and labelled arguments rescript-lang/syntax#707
- Fix 5557: the exhaustive checking for char is incorrect during the unicode migration #5749
- Fix 5753: the comment for unicode char is inaccurate rescript-lang/syntax#709
- Treat await as almost-unary operator weaker than pipe so
await foo->bar
meansawait (foo->bar)
rescript-lang/syntax#711
- Change payload of
Pconst_char
fromchar
toint
rescript-lang/syntax#709
- Fix issue with changes not being applied with React Native's Metro bundler for files with warnings #5738
- Fix emitting unary minus for floats in case of negative constants #5737
- Fix issue where a spread
...x
in non-last position would not be reported as syntax error rescript-lang/syntax#673 - Fix issue where the formatter would delete
async
in a function with labelled arguments. - Fix several printing issues with
async
including an infinite loop rescript-lang/syntax#680 - Fix issue where certain JSX expressions would be formatted differenctly in compiler 10.1.0-rc.1 rescript-lang/syntax#675
- Fix issue where printing nested pipe discards await rescript-lang/syntax#687
- Deprecate DOM element attributes in
JsxDOM.domProps
:begin_
,end_
,to_
- Use
begin
,end
,to
instead.
- Use
- Emit an error when a
@string
or@int
attribute is used in a V4 component #5724
- Add extra variants for output filename suffixes in
bsconfig.json
:.bs.mjs
and.bs.cjs
are allowed #5631 - Safe promises: t-first Js.Promise2 bindings, and remove warning for nested promises #5709
- Fix issue where uncurried async functions were emitted without
async
#5718 - Fix location issue in error messages with JSX V4 where the multiple props types are defined rescript-lang/syntax#655
- Fix location issue in make function in JSX V4 that breaks dead code elimination rescript-lang/syntax#660
- Fix parsing (hence pretty printing) of expressions with underscore
_
and comments. - Fix printing of comments inside JSX tag rescript-lang/syntax#664
- Fix issue where formatter erases tail comments inside JSX tag rescript-lang/syntax#663
- Fix issue where the JSX prop has type annotation of the first class module rescript-lang/syntax#666
- Fix issue where an empty record literal {} expected to have a non-record type would type check #5729
- Functions with consecutive dots now print as multiple arrow functions like in JavaScript.
- Add
loading
,aria-*
DOM element attributes inJsxDOM.domProps
:ariaCurrent
,ariaInvalid
,ariaAutocomplete
, etc. - Change the internal representation of props for the lowercase components to record. rescript-lang/syntax#665
- Add
JsxPPXReactSupport
module to relocate the helper functions for JSX v4 fromrescript-react
- Fix pretty printer where it would print doc comments on the same line as other attributes rescript-lang/syntax#642
- Propagte
"jsx"
configuration to dependencies #5661 - Add support for empty record literal
{}
for records where all fields are optional #5658 - Add support for empty record type (e.g.
type empty = {}
) #5658
- Fix issue in formatting JSX spread props rescript-lang/syntax#644
- Fix location issue in error messages with JSX V4 where the body of the component is an application rescript-lang/syntax#633
- Fix printing of type declarations in error message where they would be considered recursive by default
- Fix issue where the printer would omit attributes for
->
and|>
rescript-lang/syntax#629 - Fix printing of optional fields in records #5654
- Fix printing of comments inside empty blocks rescript-lang/syntax#647
- Improvements and fixes for JSX V4. See guide https://github.com/rescript-lang/syntax/blob/master/cli/JSXV4.md
- Mention all missing fields in error message for records, not just one #5657
- Pipe
->
does not support a code block on the right-hand side e.g.x->{ open A; get("test") }
- Experimental support for for
async
/await
#5537 - Make
promise
a built-in type #5650 - Initial support for JSX V4 including genType, still work in progress.
- 💥 when V4 is activated, at most one component is allowed for each module.
- Add placeholder types for ES6 collections:
Set
,Map
,WeakSet
, andWeakMap
#5630
- Fix issue with arrays and creation of recursive values #5640
- Fix issue where characters such as newlines would be escaped in a template string expression #5638
- Fix issue where pipe
->
processing eats up attributes #5581 - Fix issue where cancelling
rescript build
would leave the.bsb.lock
file behind and block future builds
- Print patterns in warnings using rescript printer #5492
- Fix issue where watch mode would give an error on Windows #5621
Compiler
bsconfig.json
does not support// line
comments anymore.- Example:
"suffix": ".bs.js" // determine the suffix
- Fix: remove the comment and use standard json.
- Example:
- Changed return type of
Js.String.match_
as it was wrong. #5070- Example: any use of
Js.String.match_
andJs.String2.match_
- Fix: follow the type errors
- Example: any use of
- GenType is now vendored in the compiler and drops support for the Flow and untyped back-ends to focus on providing a better experience for TypeScript.
- Fix: keep on using the older version of the compiler and the separate genType package if Flow support is required. Migrate to TS if one wants to upgrade the compiler version.
- New records with optional fields e.g.
type opt = {x: int, y?: string}
were added as an experimental feature #5423 #5452 New Syntax - Add support for
@new @variadic
(see #5364)
- Classify bigint correctly #5351
- Fixed crash in
rescript build
on Windows #5516 - Fixed
rescript init
command not working #5526 - Fix issue with compiler log not terminated that causes problems with editor extension not clearing issues when fixed #5545
-
Changed Linux build to depend on GLIBC 2.28 again for compatibility with Debian 10.
-
Proper M1 support (CI now supports M1 native builds)
Syntax
@bs.send.pipe
is now removed. Earlier it was deprecated.- Missing labels in function application is now an error (https://forum.rescript-lang.org/t/ann-more-strict-checks-in-missed-labels/2117).
- Example:
let f = (x, ~z) => x + z; f(1, 2)
- Fix: do
let f = (x, ~z) => x + z; f(1, ~z=2)
instead
- Example:
- Externals without
@val
annotations do not work anymore, and externals with= ""
give an error.- Example:
external setTimeout: (unit => unit, int) => float = "setTimeout"
is not supported anymore. - Fix: use
@val external setTimeout: (unit => unit, int) => float = "setTimeout"
instead. - Example2:
@val external setTimeout: (unit => unit, int) => float = ""
is not supported anymore. - Fix2: use
@val external setTimeout: (unit => unit, int) => float = "setTimeout"
instead.
- Example:
- Strings processed at compile-time don't need escaping anymore.
- Example:
let blockCommentsRe = %re("/\\/\\*([^*]|[\\r\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+\\//g")
. - Fix: use
let blockCommentsRe = %re("/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\//g")
instead.
- Example:
- Remove parsing of "import" and "export" which was never officially supported rescript-lang/syntax#597 rescript-lang/syntax#599
- Example:
export type t = int
- Fix:
@genType type t = int
- Example2:
import realValue: complexNumber => float from "./MyMath"
- Fix2:
@genType.import("./MyMath") external realValue: complexNumber => float = "realValue"
- Example:
- Unicode is now supported in regular strings and chars (when the symbol fits). This is now going to work:
let str = "Σ"
. And, you'll be able to pattern match on unicode chars:switch c { | 'Σ' => "what a fine unicode char" | _ => "unicode is fun" }
- Doc comments
/** ... */
are now supported. Inernally, they are attributes, so are only valid at positions where@foo
is allowed, or a syntax error is given. Similarly for module-level/*** comments */
that can go where@@attributes
go.
- Fix printing for inline nullary functor types #477
- Fix stripping of quotes for empty poly variants #474
- Implement syntax for arity zero vs arity one in uncurried application in #139
- Fix parsing of first class module exprs as part of binary/ternary expr in #256
- Fix formatter hanging on deeply nested function calls #261
Libraries
- "Attributes not allowed here". If you see this error chances are you're using a ppx that needs updating to a new version.
See an exampe of how to update a ppx
- Example: for
rescript-relay
0.23.0 is not supported. - Fix: use
rescript-relay@beta
or the new version when released.
- Example: for
- Removed printing modules (Printf, Format etc) and related functions. Details of files added/removed: https://github.com/rescript-lang/rescript-compiler/commit/0fd8bb0e77c4b0e96a9647ac8af614305057003f.
- Several Belt / Js libraries are now converted to ReScript syntax, with corresponding comments in Markdown format suitable for hovering. See #5361.
Playground
- Added
jsoo_playground_main.ml
as the rescript-lang.org playground bundle entrypoint
- Removed Reason syntax support for the playground experience. See #5375
You can find more old changelog from docs/changelog