Skip to content

Latest commit

 

History

History
1176 lines (814 loc) · 80.5 KB

CHANGELOG.md

File metadata and controls

1176 lines (814 loc) · 80.5 KB

Changelog

Tags:

  • 💥 [Breaking Change]
  • 👓 [Spec Compliance]
  • 🚀 [New Feature]
  • 🐛 [Bug Fix]
  • 📝 [Documentation]
  • 🏠 [Internal]
  • 💅 [Polish]

12.0.0-alpha.7 (Unreleased)

🏠 Internal

  • AST cleanup: use inline record for Pexp_fun. #7213

💅 Polish

  • Add all standard CSS properties to JsxDOMStyle. #7205

12.0.0-alpha.6

🚀 New Feature

  • Add Option.all & Result.all helpers. #7181
  • Add @react.componentWithProps for React component functions taking a props record instead of labeled arguments. #7203

🐛 Bug fix

  • 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

🏠 Internal

  • 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

12.0.0-alpha.5

🚀 New Feature

  • Introduce "Unified operators" for arithmetic operators (+, -, *, /, mod). #7057
  • Add remainder (%, aka modulus) operator. #7152

🐛 Bug fix

  • Fix and clean up boolean and/or optimizations. #7134 #7151
  • Fix identifiers with name arguments and eval to be mangled. #7163

💅 Polish

  • 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

🏠 Internal

  • Move rescript-editor-analysis and rescript-tools into compiler repo. #7000

12.0.0-alpha.4

💥 Breaking Change

  • OCaml compatibility in the stdlib and primitives are dropped/deprecated. #6984
  • Remove JSX v3. #7072
  • Remove js_cast.res. #7075

🚀 New Feature

  • 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

🐛 Bug fix

  • 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

💅 Polish

  • 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

🏠 Internal

  • 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 the tests folder. #7096
  • Move syntax_tests into the tests folder. #7090 #7097
  • Capitalize runtime filenames. #7110
  • Build mocha tests as esmodule / .mjs. #7115
  • Use dict instead of Dict.t everywhere. #7136

12.0.0-alpha.3

🐛 Bug fix

  • Revert "Throws an instance of JavaScript's new Error() and adds the extension payload for cause option" (#6611). #7016
  • Fix dict literals error. #7019

12.0.0-alpha.2

🚀 New Feature

  • 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

🐛 Bug Fix

  • 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

🏠 Internal

  • Add dev container. #6962
  • Convert more tests to the node test runner. #6956
  • Remove attribute "internal.arity". #7004
  • Remove dead modules. #7008

💅 Polish

  • 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 from switch statement in the generated code
  • Optimised the Type Extension runtime code and removed trailing /1 from RE_EXN_ID. #6958
  • Compact output for anonymous functions. #6945 #7013
  • Rewatch 1.0.9. #7010

12.0.0-alpha.1

🚀 New Feature

  • 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 for cause 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

💥 Breaking Change

  • Make j and js allowed names for tag functions. #6817
  • lazy syntax is no longer supported. If you're using it, use Lazy module or React.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 in Js_typed_array that rely on @bs.send.pipe. #6858 #6891
  • Remove deprecated Js.Vector and Js.List. #6900
  • Remove support for %time extension. #6924
  • Remove caml_external_polyfill module and the related behavior. #6925

🐛 Bug Fix

  • 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 uses Curry 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

🏠 Internal

  • 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 and js_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) into Js.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

💅 Polish

  • 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 of var. #6102
  • Turn off transformation for closures inside loops when capturing loop variables, now that let is emitted instead of var. #6480
  • Improve unused attribute warning message. #6787
  • Remove internal option use-stdlib from build schema. #6778
  • Fix Js.Types.JSBigInt payload to use native bigint 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

11.1.3

🐛 Bug Fix

  • 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 to Curry 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

11.1.3-rc.1

🐛 Bug Fix

  • Omit standard library dir from load path if -nostdlib is set. #6833

11.1.2

🐛 Bug Fix

  • Fix issue where capitalised type variables were only allowed in certain positions. #6820

11.1.2-rc.1

🚀 New Feature

  • Support Windows 11 ARM (using the x64 binaries in emulation). #6813

🐛 Bug Fix

  • 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

11.1.1

🐛 Bug Fix

  • 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

11.1.0

🐛 Bug Fix

  • Revert escape JSX prop names with hyphens (#6705). #6731

11.1.0-rc.8

🚀 New Feature

  • Add %todo extension for leaving implementation for later. #6713
  • Add -warn-error argument for generating errors in CI. Useful for %todo extension. #6717

🐛 Bug Fix

  • 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 in React.forwardRef component. #6718
  • Fix description for warning number 110. #6725

💅 Polish

  • Module spec es6 and es6-global is deprecated in favor of esmodule. #6709

11.1.0-rc.7

🐛 Bug Fix

  • Fix variance setting for builtin dict type. Fixes issues around inference. #6707

11.1.0-rc.6

🚀 New Feature

🐛 Bug Fix

  • Fix mishandling of uncurried functions in super errors. #6694

11.1.0-rc.5

🐛 Bug Fix

  • Fix misparsing in/after JSX. #6686
  • Fix @deriving(accessors) outputting curried functions in uncurried mode. #6687

11.1.0-rc.4

🐛 Bug Fix

  • 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

:nail-care: Polish

  • 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

11.1.0-rc.3

💅 Polish

  • No parens around tagged template literals. #6639
  • Allow identifier with modules in tagged template literals (e.g. Pg.sqlselect * from ${table} where id = ${id}). #6645

🐛 Bug Fix

  • Fix compiler crash when reexporting tagged template literal externals. #6645

11.1.0-rc.2

🚀 New Feature

🐛 Bug Fix

  • Fix issue with async and newtype in uncurried mode. #6601
  • Generic JSX transform: Rename expected module name for lowercase JSX to Elements from DOM. #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

🏠 Internal

  • Use OCaml 4.14.1 (+ Alpine 3.19 container) for CI build. #6600

11.1.0-rc.1

🚀 New Feature

  • 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

🐛 Bug Fix

  • GenType: distinguish inline records from unary variant cases of object type. #6586

11.0.1

🐛 Bug Fix

  • 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

💅 Polish

  • Improve error message for missing label(s) in function application. #6576

11.0.0

No changes compared to rc.9.

11.0.0-rc.9

🚀 New Feature

  • 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

🐛 Bug Fix

  • GenType: now emits full suffix on JS import path to be compatible with .res.js. #6541

💅 Polish

  • Format docstrings. #6417
  • JSX v4: make automatic mode the default. #6552

11.0.0-rc.8

🚀 New Feature

  • Add support for type coercion for invariant type arguments such as array payloads. #6518
  • Start treating rescript command the same as the rescript build command, so now you can do rescript -w. #6524

🐛 Bug Fix

  • Fix accidental removal of Belt.Result.Ok and Belt.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

💅 Polish

  • GenType: make outputs DCE-friendly. #6508

11.0.0-rc.7

🚀 New Feature

  • Allow empty inline records in variants. #6494
  • Allow empty record patterns in pattern matching. #6494

🐛 Bug Fix

  • 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

11.0.0-rc.6

🚀 New Feature

  • Freely configurable suffix for generated .js files. #6472

🐛 Bug Fix

  • 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

💅 Polish

  • Improve some error messages in rescript.conf parsing. #6469

11.0.0-rc.5

🚀 New Feature

  • 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 to float. #6448

🐛 Bug Fix

  • 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 function unsafe_await). #6452
  • Fix renaming fields (with @as) in inline records doesn't work when destructuring. #6456
  • Fix rc.4 regressions:
    • Don't show compilation time when calling rescript build -help command. #6439
    • Running rescript build -w with a compilation error doesn't exit with an error code and continues waiting for changes. #6460

🏠 Internal

  • Remove dependency stdlib-406 -> belt. #6453
  • Playground: Add support for implicitly opened modules. #6446

💅 Polish

  • Add Deno to reserved names, so that modules named Deno don't clash with the globally exposed Deno object. #6428
  • Disable ESLint/TSLint on gentype outputs properly. #6442
  • Improve rescript CLI to use stdout/stderr appropriately for help command's message. #6439
  • Generate f() instead of f(undefined) for f(). #6459

11.0.0-rc.4

🚀 New Feature

  • 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 deprecate bsconfig.json. #6382

💥 Breaking Change

  • 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 uses Boolean(bool) instead of explicit @as(true) True | @as(false) False. #6421

🐛 Bug Fix

  • 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

💅 Polish

  • 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 and clean 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

11.0.0-rc.3

🐛 Bug Fix

  • 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

💅 Polish

  • Add Bun to reserved names, so that modules named Bun don't clash with the globally exposed Bun object. #6381

11.0.0-rc.2

🚀 New Feature

  • rescript build will always build its dependency by default. The argument -with-deps is not needed anymore. #6350

💥 Breaking Change

  • 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

🐛 Bug Fix

  • Fixed outcome printer resolution of uncurried config. #6353

11.0.0-rc.1

🚀 New Feature

  • GenType: Propagate comments from record fields to emitted TypeScript types. #6333

💥 Breaking Change

  • $$default is no longer exported from the generated JavaScript when using default exports. #6328

💅 Polish

  • 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

11.0.0-beta.4

🚀 New Feature

  • 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

💥 Breaking Change

  • 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

🐛 Bug Fix

  • Fixed outcome printing of uncurried higher order function types. #6323
  • Fixed printing of type constraints in template literal substitutions. #6324

11.0.0-beta.3

🚀 New Feature

  • 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

🐛 Bug Fix

  • Fix issue with dynamic import of modules in expressions. #6310

11.0.0-beta.2

🚀 New Feature

  • 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

💥 Breaking Change

  • Remove rudimentary node bindings and undocumented %node extension. #6285

🐛 Bug Fix

  • 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

11.0.0-beta.1

🚀 Main New Feature

  • Make uncurried mode opt-out: by default, every project is now in uncurried mode, unless "uncurried": false is specified in the project config. #6249

💅 Polish

  • Removed duplicate Super_error implementation in syntax. #6246

🐛 Bug Fix

  • Fix issue with inlining records in the presence of record coercion. #6256

11.0.0-alpha.6

💥 Breaking Change

  • -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

🐛 Bug Fix

  • 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

💅 Polish

  • 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 and Js.nullable are now untagged variants representing their runtime values, instead of abstract types. #6218

11.0.0-alpha.5

🚀 Main New Feature

  • 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. #6182
    • node (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

💥 Breaking Change

  • Parse assert as a regular function. assert is no longer a unary expression. Example: before assert 1 == 2 is parsed as (assert 1) == 2, now it is parsed as assert(1 == 2). #6180

🐛 Bug Fix

  • 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

11.0.0-alpha.4

🚀 Main New Feature

  • Add surface syntax for partial application of uncurried functions: foo(1, ...). This corresponds to curried application in the old mode. #6166

🐛 Bug Fix

  • 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

💅 Polish

  • Update list of reserved JS keywords. #6167
  • Add error message to @@directive. #6174

11.0.0-alpha.3

🚀 Main New Feature

  • Add support for extensible records (e.g. type t = {...t1, x:int, ...t2}) #5715

🐛 Bug Fix

  • Fix formatting and parentheses placement in uncurried functions with constraints. #6143

11.0.0-alpha.2

🚀 Main New Feature

  • Add support for type coercion :> for records. #5721

🐛 Bug Fix

  • Special case generation of uncurried functions with 1 argument of unit type so they don't take a parameter. #6131

11.0.0-alpha.1

🚀 Main New Feature

  • Introduce experimental uncurried mode. For experimentation only. PR #5796
  • Customization of runtime representation of variants and introduction of untagged variants PR #6095, PR #6103

🚀 New Feature

  • 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 in bsconfig.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. The make 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

💥 Breaking Change

  • 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 to Math.pow(2, Math.pow(3, 2)) and not anymore Math.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

🐛 Bug Fix

  • 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

💅 Polish

  • 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

10.1.4

🐛 Bug Fix

  • 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

🚀 New Feature

  • Add support for toplevel await #6054

💅 Polish

  • 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

10.1.3

🚀 New Feature

  • Add experimental suppport for directives. An annotation such as @@directive("use client;") emits use client; verbatim before imports #5999
  • genType: add Core 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

💥 Breaking Change

  • genType: streamline the treatment of optionals as undefined #6024
    • Represent option<t> as undefined | t instead of null | 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: use Js.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}.

💅 Polish

  • Add the gap property to jsxDOMStyle #5956

🐛 Bug Fix

  • 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 where then and catch were returning undefined #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 braced cases 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 type float #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

10.1.2

🐛 Bug Fix

  • Fix an issue where error messages related to duplicate props were displayed without a loc and were unclear rescript-lang/syntax#728

10.1.1

💥 Breaking Change

  • 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

🚀 New Feature

  • Add support for empty inlined record literal {} for inlined records where all fields are optional #5900

🐛 Bug Fix

  • 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

10.1.0

🐛 Bug Fix

  • 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

10.1.0-rc.5

🐛 Bug Fix

  • Prevent inlining of async functions in last stage of the compiler when the functions are not exported (not in interface file or shadowed) #5790

10.1.0-rc.4

🚀 New Feature

  • Support format check with rescript format -check. #5760

🐛 Bug Fix

  • 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

10.1.0-rc.3

🚀 New Feature

🐛 Bug Fix

💅 Polish

10.1.0-rc.2

🐛 Bug Fix

  • 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

10.1.0-rc.1

💥 Breaking Change

  • Deprecate DOM element attributes in JsxDOM.domProps: begin_, end_, to_
    • Use begin, end, to instead.
  • Emit an error when a @string or @int attribute is used in a V4 component #5724

🚀 New Feature

  • 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

🐛 Bug Fix

  • 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

👓 Spec Compliance

  • Functions with consecutive dots now print as multiple arrow functions like in JavaScript.

💅 Polish

  • Add loading, aria-* DOM element attributes in JsxDOM.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 from rescript-react

10.1.0-alpha.2

🚀 New Feature

  • 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

🐛 Bug Fix

💅 Polish

10.1.0-alpha.1

💥 Breaking Change

  • Pipe -> does not support a code block on the right-hand side e.g. x->{ open A; get("test") }

🚀 New Feature

  • 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, and WeakMap #5630

🐛 Bug Fix

  • 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

💅 Polish

  • Print patterns in warnings using rescript printer #5492

10.0.1

🐛 Bug Fix

  • Fix issue where watch mode would give an error on Windows #5621

10.0.0

Compiler

💥 Breaking Change

  • bsconfig.json does not support // line comments anymore.
    • Example: "suffix": ".bs.js" // determine the suffix
    • Fix: remove the comment and use standard json.
  • Changed return type of Js.String.match_ as it was wrong. #5070
    • Example: any use of Js.String.match_ and Js.String2.match_
    • Fix: follow the type errors
  • 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 Feature

  • 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)

🐛 Bug Fix

  • 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
💅 Polish
  • 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

💥 Breaking Change

  • @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
  • 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.
  • 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.
  • 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"

🚀 New Feature

  • 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.

🐛 Bug Fix

  • 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

💥 Breaking Change

🐛 Bug Fix

  • Fix library issue with missing bytes_to_string #5573 #5589

💅 Polish

  • Several Belt / Js libraries are now converted to ReScript syntax, with corresponding comments in Markdown format suitable for hovering. See #5361.

Playground

🏠 Internal

  • Added jsoo_playground_main.ml as the rescript-lang.org playground bundle entrypoint

💥 Breaking Change

  • Removed Reason syntax support for the playground experience. See #5375

You can find more old changelog from docs/changelog