Skip to content

13.0.0-alpha.6

Pre-release
Pre-release

Choose a tag to compare

@cknitt cknitt released this 16 Sep 14:20
· 15 commits to master since this release
ede3703

馃挜 Breaking Change

  • Remove %re; use regexp literals instead. #8634
  • Reject malformed UTF-8 in documentation comments and invalid escapes in string and template literals, which previously could produce invalid or inconsistent JavaScript. #8606
  • Reject tagged template literals in patterns. Patterns cannot invoke their tag; previously their raw payload was compiled as a plain string comparison. #8606
  • Remove runtime APIs that were deprecated for removal in ReScript 13, including the Char module, unsafe Obj operations, legacy Pervasives helpers, and Array.unsafe_get. #8564
  • Remove the deprecated Js namespace and its runtime modules. #8531
  • Move Belt into the separately installed @rescript/belt package. Projects using Belt must install the package and list it in their rescript.json dependencies. #8554
  • Correct the structured function details returned by rescript-tools doc, preserving parameter labels, optionality, and nested type structure. This changes the published RescriptTools.Docgen schema. #8576
  • Make object-field mutability part of the type. Fields require @set unless inferred settable on an open row; private rows and coercions no longer implicitly grant write access. #8597
  • Remove the undocumented object-field attribute forms @get (bare or with a null/undefined/nullable payload) and @set({no_get: ...}) on object types. Only bare @set marks a field settable; nullable getter types are written directly (null<t>, undefined<t>, nullable<t>). #8597
  • Remove Int.Ref and the obsolete %incr, %decr, %refget, %function_arity, %succint, and %predint builtins. Custom externals using these names are now rejected. #8616 #8608
  • Remove the reanalyze -reactive option; reanalyze now always uses the reactive pipeline. #8648
  • Interpret @this this => async arg => ... as a method returning an async function. To create an async method with both parameters, write @this async (this, arg) => .... #8566

馃殌 New Feature

  • Support UTF-16 surrogate-pair escapes such as "\uD83D\uDE00" in ordinary string literals. #8606
  • Support dynamic imports of external bindings annotated with @scope; the generated import follows the complete property path. These imports were previously rejected. #8582
  • Add @res.hoistedFunction for emitting nested module functions as flat JavaScript exports. #8402
  • Add source map support with linked, inline, and hidden modes. #8393
  • Add List.includes, deprecate List.has in favor of List.some, and clarify the equality semantics of List.includes and Array.includes. #8530
  • Allow inferred labeled functions to be called with labels in any order. #8547

馃悰 Bug fix

  • Fix reanalyze incorrectly reporting labels and variant cases of re-exported types as dead in the editor. #8647 #8648
  • Fix reanalyze incorrectly reporting record fields accessed through coercions as dead. #8643 #8645
  • Report reanalyze findings in stable source order across machines. #8648
  • Fix speculative parser lookahead suppressing syntax errors for malformed attributes and inline records in non-arrow external declarations. #8633
  • Preserve list elements when recovering from unexpected delimiters, and report invalid type-argument parentheses at their opening. #8633
  • Fix constant folding of pattern matches on unboxed variants whose payload overlaps a literal constructor, and report an error instead of crashing on multi-argument unboxed constructors. #8631
  • Fix escaped backticks and interpolation openers in backquoted %raw, %ffi, and %re payloads leaking into emitted JavaScript. #8630
  • Preserve unused bigint exponentiation and bounds-checked array or string reads that may throw instead of removing them as pure expressions. #8617
  • Preserve record field @as annotations when formatting object types containing spreads. #8619
  • Fix lost leading comments on labeled callbacks and unstable formatting of trailing callback comments. #8627
  • Fix record-field completion inside constructor tuple payloads and for their destructured bindings, including both supported tuple spellings and polymorphic variants. #8610
  • Limit constructor signature help to the argument parentheses, excluding whitespace and comments between the constructor name and its arguments, and keep unary tuple payloads on parameter zero. #8610
  • Fix formatting of function assignments, return-type parentheses, and JSX fragments in callbacks. #8611
  • Report an error instead of crashing when an integer in a variant constructor's @as annotation exceeds the compiler's integer range. #8619
  • Warn about an @as on a record field whose payload does not name the field, such as @as(42). It renamed nothing and was silently accepted. #8619
  • Preserve side effects in recursive modules with empty signatures. #8608
  • Report a proper error instead of crashing on out-of-range numeric polymorphic variant names. #8608
  • Object typing errors now describe fields directly: assigning to a field without @set reports that the field is not settable and suggests the annotation, and missing-property errors name the field instead of a phantom "x#=" member. #8597
  • Fix pattern matching for string literals with equivalent runtime values but different escape spellings, preserving source order and reporting redundant patterns. #8606
  • Fix signature inclusion rejecting equivalent object externals after type-alias expansion. #8581
  • Fix externals whose result type is an alias of unit so they use the same unit-return behavior as externals declared to return unit. #8581
  • Fix dynamic imports of external bindings that require FFI argument or result conversions, including @variadic, @unwrap, polymorphic variant encodings, @as phantom arguments, optional labeled arguments, and @return wrappers. The imported value now applies the same conversions as a direct external call. #8582
  • Fix formatter breaking the opening brace of a functor module type's result signature onto a new line (e.g. module Make: Pattern => {). #8519
  • Keep doc-commented inline-record exception and type-extension constructors on one line when they fit. #8622
  • Fix argument evaluation order when a function call is inlined: the beta reducer stacked argument bindings in reverse parameter order, so the last argument was evaluated first when arguments could not be substituted directly. #8572
  • Preserve parentheses around multiplication, division, and modulo expressions used as exponents. #8550
  • Fix the formatter misplacing attributes and comments on locally abstract type parameters. #8574
  • Preserve trailing comments between the type and = in locally abstract value constraints (let f: type a. t /* comment */ = value). #8575
  • Enforce function arity in interface/module inclusion and type coercion. Previously a curried implementation (e.g. int => int => int) could satisfy an uncurried interface ((int, int) => int) or be coerced to it, which could miscompile calls made through the interface type. Such mismatches are now compile errors with an explanatory hint. #8559
  • Fix termination-analysis false positives when progress flows through an unannotated helper function. #8568
  • Fix default values of optional parameters being computed at the wrong time for curried functions: in (~x=default, y) => (~z=default, w) => ..., x's default was only computed when the inner function was applied. Each default is now computed when its own parameter group is applied. #8568
  • Fix bare labeled arrow types (~x: int => string) getting no arity: they printed identically to their parenthesized form ((~x: int) => string) but did not unify with it. #8563
  • Fix losses of fidelity when code passes through an external PPX: the internal @res.async marker no longer leaks into the program, attributes on an arrow type or on an await expression are no longer dropped or relocated (previously this could crash the formatter), JSX elements keep their closing tag, and PPX-emitted OCaml-style function is desugared instead of crashing the compiler. #8561
  • Preserve multibyte characters when wrapping long source lines in compiler code frames. #8520
  • Fix reanalyze optional-argument diagnostics for functions passed or returned as first-class values. #8321
  • Prevent the developer playground from loading stale compiler and library assets after PR preview updates. #8556

馃拝 Polish

  • Omit unnecessary parentheses around coercions where the surrounding syntax already delimits the expression, while preserving required grouping. #8614
  • Print external declarations in signatures and type errors with their processed attributes instead of the "#rescript-external" placeholder, and print inline constants using @inline syntax. #8581
  • Improve diagnostics for dynamic imports of local values and attempts to use import as a first-class value. #8582
  • Format an @as payload written as a backquoted string with ordinary quotes, on both record fields and variant constructors, since it names the same thing either way. #8619
  • Use label-derived JavaScript names for optional parameters with defaults, and report unused ones as unused parameters rather than unused let bindings. #8580

馃彔 Internal

  • Remove the unused Jane Street base dependency left over from vendoring the Flow parser. #8655
  • Separate parser token inspection from consumption and move missing JSX prop recovery into the parser. #8633
  • Give regexp literals a dedicated AST node. #8634
  • Make developer playground panes resizable with wrapping text. #8628
  • Remove the obsolete Lam pane from the developer playground. #8626
  • Normalize more Lambda terms as they are constructed. #8615
  • Generalize reference unboxing to scalar replacement of non-escaping mutable records. #8617
  • Split the Lambda IR definition from its traversals, static exits, and path translation. #8618
  • Store record-field and variant-constructor @as names directly on their declarations. #8619
  • Preserve physical sharing when optimization passes make no changes. #8620
  • Unify the parser modes used for printing and type checking while preserving existing syntax and PPX compatibility. #8610
  • Merge the duplicate Lam representation into a single private Lambda IR. #8608
  • Add genType and source map controls and output to the developer playground. #8448
  • Simplify the object-type representation and share property access and assignment across the compiler pipelines. #8597
  • Upgrade the development toolchain and primary CI builds to OCaml 5.5.1 while retaining OCaml 5.0 as the minimum supported version. #8589 #8654
  • Upgrade the vendored Flow parser from 0.267.0 to 0.320.0, the final release of the OCaml implementation. #8588
  • Vendor the Flow parser 0.267.0 sources used by the compiler, removing the external flow_parser dependency and establishing a maintained baseline for future OCaml upgrades. #8587
  • Represent processed externals structurally and lower their calls during Lambda translation, with corresponding AST, CMI, and CMT format bumps. #8581
  • Resolve and store dynamic-import targets during Lambda translation. #8582
  • Compute one canonical runtime layout for nominal variants and share it across compiler consumers. #8579
  • Represent optional parameters with defaults structurally instead of detecting generated names. #8580
  • Promote compiler binaries into platform npm packages on every dune build, preventing stale binaries outside Make-based builds. #8560
  • Remove unused compiler IR definitions, modules, helpers, error variants, and Typedtree fields. #8551 #8555
  • Make Lambda conversion structural and align primitive and constant representations across the former Lambda and Lam layers. #8604
  • Represent locally abstract value constraints directly in the parsetree while keeping the external PPX encoding compatible. #8575
  • Make function representations structurally n-ary across parsed and typed ASTs, removing legacy arity annotations, adapters, and cleanup machinery. #8566 #8568 #8569 #8570
  • Give current-parsetree binary streams magic numbers distinct from the frozen external PPX format. #8561
  • Record external parameter counts before erasing phantom @as(...) _ arguments. #8563
  • Add the -check-lam compiler option, enable Lambda invariant checking in compiler tests, and remove build-profile-dependent checking. #8534
  • Replace -bs-diagnose with -debug-ir and make IR diagnostic artifacts deterministic, compilation-local, and easy to clean. #8535
  • Replace CPPO-based browser conditionals with Dune-selected native and playground compiler implementations. #8541
  • Replace compiler data-structure CPPO specializations with OCaml functors. #8542
  • Remove the obsolete CPPO generator for frozen Belt runtime specializations. #8543