Skip to content

Remove stdlib APIs deprecated in v12 - #9052

Merged
cknitt merged 4 commits into
masterfrom
remove-v12-deprecations
Oct 26, 2026
Merged

cknitt merged 4 commits into
masterfrom
remove-v12-deprecations

Conversation

@cknitt

@cknitt cknitt commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Removes every standard library API that v12 deprecated, plus List.has and the Error/Exn modules, which 12.3.2 deprecates (#8807). After this PR, the runtime has no @deprecated items left. #8564 already removed the items explicitly scheduled for v13.

Release order: this PR may merge before 12.3.2 ships, but 13.0.0 must be released after 12.3.2. The migration templates live in the v12 stdlib, so users run rescript-tools migrate-all on 12.3.2 before upgrading.

Removed, by module:

  • Pervasives: raise, failwith, invalid_arg, Exit; Stdlib: Error, Exn, lazy_t, window, document
  • Array: copyAllWithin, copyWithinToEnd, fillAll, fillToEnd, indexOfFrom, lastIndexOfFrom, joinWith, joinWithUnsafe, sliceToEnd
  • Typed arrays, ArrayBuffer, DataView: fromBufferToEnd, fromBufferWithRange, fromArrayLikeOrIterableWithMap, sliceToEnd, TypedArray.copyWithinToEnd, …
  • BigInt: fromStringExn, toStringWithRadix, land/lor/lxor/lnot/lsl/asr; Int/Float: *WithRadix, *WithPrecision, rangeWithOptions, Int.Bitwise
  • JSON: parseExn*, stringify*With*, stringifyAny*With*, Classify
  • List: has, headExn, getExn, getAssoc/hasAssoc/setAssoc/removeAssoc, toShuffled
  • Option/Result/Null/Nullable: getExn, getWithDefault, mapWithDefault; Bool.fromStringExn; Lazy: force, force_val, from_fun, from_val, is_val; String: sliceToEnd, substringToEnd, unsafeReplaceRegExpBy0..3; RegExp.fromStringWithFlags; Promise.done
  • JsxDOM: begin_, end_, to_ props

Reanalyze, gentype and completion no longer reference Error/Exn.

Ecosystem: the latest releases of rescript-nodejs (17.0.0) and rescript-bun (2.1.0) still call failwith and catch Exn.Error. The rewatch test repo patches them with Yarn patches; the libraries need a release before v13. The replacements (throw(Failure(...)), JsExn) already work on v12.

New tests: the 14 StdlibMigration_* fixtures in tests/tools_tests exercised templates of the removed APIs. They are replaced by DeprecatedTemplates + Migrate_Templates, which declare type, constructor, labelled-argument, inserted-argument and operator templates locally. That keeps the migration tool's coverage independent of the stdlib.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FrejUgZbjj4wX44oqa67V5

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Changelog

💥 Breaking Change

  • Remove the standard library APIs deprecated in v12, including List.has and the Error and Exn modules. Run rescript-tools migrate-all with ReScript 12.3.2 before upgrading to migrate your code automatically.

Semantic Diff

4 commits · Full page

Remove stdlib APIs deprecated in v12

bf4e2c5 · cknitt + Claude · Oct 26, 2026, 09:57 UTC

Why

v12 deprecated these APIs with migration templates, so v13 can drop them. List.has and the Error and Exn modules are deprecated in 12.3.2 (#8807) and go as well. Reanalyze, gentype and completion no longer name the removed modules.

⚠️ Breaking: Code using a removed API no longer compiles. Run rescript-tools migrate-all with ReScript 12.3.2 before upgrading; 13.0.0 must therefore be released after 12.3.2.

Review

  • Why does lam_analysis lose its Lazy.from_fun case? That case treated a call to the removed Lazy.from_fun as free of side effects; no program can call it any more.
Replace the stdlib migration fixtures with a self-contained one

9ef4fe2 · cknitt + Claude · Oct 26, 2026, 09:57 UTC

The StdlibMigration_* fixtures exercised the templates of the removed stdlib APIs. DeprecatedTemplates declares the same template shapes locally, so the migration tool keeps its coverage.

Migrate tests to the replacement APIs

fd9924f · cknitt + Claude · Oct 26, 2026, 09:57 UTC

Tests and fixtures that used the removed APIs now use the replacements their migration templates name; snapshots are regenerated.

Patch the test repo's bindings for the removed stdlib APIs

7b0ea27 · cknitt + Claude · Oct 26, 2026, 10:10 UTC

rescript-nodejs 17.0.0 and rescript-bun 2.1.0, the latest releases, call failwith and catch Exn.Error, so the rewatch test repo stopped compiling. Yarn patches replace them with throw(Failure(...)) and JsExn, which v12 accepts as well.

@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.41%. Comparing base (230405f) to head (7b0ea27).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9052      +/-   ##
==========================================
+ Coverage   81.39%   81.41%   +0.01%     
==========================================
  Files         459      459              
  Lines       64548    64546       -2     
==========================================
+ Hits        52542    52547       +5     
+ Misses      12006    11999       -7     
Files with missing lines Coverage Δ
analysis/reanalyze/src/exn.ml 100.00% <ø> (ø)
analysis/reanalyze/src/exn_lib.ml 100.00% <ø> (ø)
analysis/src/completion_back_end.ml 81.48% <100.00%> (ø)
compiler/core/lam_analysis.ml 78.91% <ø> (-0.82%) ⬇️
compiler/gentype/translate_type_expr_from_types.ml 88.80% <100.00%> (+0.34%) ⬆️

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cknitt

cknitt commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T10:25:43.010990Z ae22d44 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: ae22d44c71

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@pkg-pr-new

pkg-pr-new Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@9052

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@9052

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@9052

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@9052

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@9052

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@9052

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@9052

commit: 7b0ea27

@github-actions

Copy link
Copy Markdown

@cknitt
cknitt requested a review from fhammerschmidt October 26, 2026 11:53
@cknitt
cknitt marked this pull request as ready for review October 26, 2026 11:53
cknitt and others added 4 commits October 26, 2026 14:13
Why:
    v12 deprecated these APIs with migration templates, so v13 can drop
    them. List.has and the Error and Exn modules are deprecated in 12.3.2
    (#8807) and go as well. Reanalyze, gentype and completion no longer
    name the removed modules.

Review: Why does lam_analysis lose its Lazy.from_fun case? That case
    treated a call to the removed `Lazy.from_fun` as free of side effects;
    no program can call it any more.
Breaking: Code using a removed API no longer compiles. Run
    `rescript-tools migrate-all` with ReScript 12.3.2 before upgrading;
    13.0.0 must therefore be released after 12.3.2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ZYFYMu3AE9P1xFVCR34d1
Signed-off-by: Christoph Knittel <ck@cca.io>
The StdlibMigration_* fixtures exercised the templates of the removed
stdlib APIs. DeprecatedTemplates declares the same template shapes
locally, so the migration tool keeps its coverage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ZYFYMu3AE9P1xFVCR34d1
Signed-off-by: Christoph Knittel <ck@cca.io>
Tests and fixtures that used the removed APIs now use the replacements
their migration templates name; snapshots are regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ZYFYMu3AE9P1xFVCR34d1
Signed-off-by: Christoph Knittel <ck@cca.io>
rescript-nodejs 17.0.0 and rescript-bun 2.1.0, the latest releases, call
failwith and catch Exn.Error, so the rewatch test repo stopped compiling.
Yarn patches replace them with throw(Failure(...)) and JsExn, which v12
accepts as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FrejUgZbjj4wX44oqa67V5
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt
cknitt force-pushed the remove-v12-deprecations branch from ae22d44 to 7b0ea27 Compare October 26, 2026 14:21
@cknitt
cknitt merged commit 1178cb3 into master Oct 26, 2026
26 checks passed
@cknitt
cknitt deleted the remove-v12-deprecations branch October 26, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants