Skip to content

Remove dead code found by reanalyze - #9173

Open
cknitt wants to merge 11 commits into
masterfrom
remove-dead-code-reanalyze
Open

cknitt wants to merge 11 commits into
masterfrom
remove-dead-code-reanalyze

Conversation

@cknitt

@cknitt cknitt commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Removes the dead code that reanalyze's dead-code analysis finds in the OCaml sources, and adds make dead-code to check for it. The analysis runs over both the native and the browser (playground) build, so uses in either count. The vendored compiler/flow_parser is left to the rest of the stack (#9267, #9208).

What goes

  • Compiler:
    • Unused exports and helpers:
      • Ext_list.concat_append and Request_local.set.
      • Misc.Color's ansi_of_style_l, styles and default_styles exports. They're still used inside Misc; the color palette itself stays, see "Kept" below.
      • Unused Ast_literal values.
      • Ast_fixed_arg.of_payload/to_expression.
      • Ast_helper.Jsx_component.to_attribute.
      • Ctype.apply.
      • Ast_helper0 builders for OCaml-only constructs (new_, setinstvar, override, lazy_, extension rebind).
    • Lam_id_kind's MutableBlock/Exception/boxed Undefined, which nothing produces. With them go Lambda.Pis_undefined and Js_exp_make.is_undef, which only they produced.
    • Two Bsc_args actions, Includecore.Field_arity (an error never raised), and the hash_string_int primitive with its C stub.
    • The playground's int_unsafe_blit, and Typedtree_iter's default enter_expression, which every iterator overrides.
  • rewatch-ocaml:
    • Two exception aliases that were only matched (the originals are used instead), and an unused export.
    • Code that recent master changes left unused: Build_session.iter_package_plans, the never-read Package_plan.t.source_files, and the File_util.read_build_file export.
  • Editor analysis / reanalyze:
    • Unused helpers, Completion fields, package.dependencies, the never-produced Circular issue, and never-read fields of the reactive pipeline.
    • package.rescript_version, with its ^ve+/^ve- analysis-test directive.
    • Two reactive collections (file_deps_map, files) that were computed but never consumed. They were the only readers of the File_deps builder, so that write-only tracking goes too.
  • .cmi/.cmt fields:
    • Cmt_format.cmt_infos fields nobody reads (cmt_comments, cmt_sourcefile, cmt_builddir, cmt_loadpath, cmt_initial_env, cmt_imports, cmt_use_summaries).
    • Plus Cmt_utils.deprecated_text, Types.lbl_attributes, Typedtree.ext_name, Primitive.prim_alloc and Env.Env_constraints.
    • v13 has a new format version anyway, and the release bumps the magic numbers.
  • Code master's in-memory build-file writes (Read build files once and publish outputs from memory in OCaml rewatch #9170) left unused: Misc.output_to_bin_file_directly, Ext_buffer.output_buffer, Cmi_format.read_cmi_channel and Cmi_format.input_cmi.
  • Optional arguments no caller passes:
    • Mostly ?comment in Js_exp_make/Js_stmt_make. Only the @__PURE__ annotation on exception creation and the /* [] */ and assert_false hints still produce comments, so the generated JS is unchanged.
    • The rest are parameters whose default was always taken, e.g. Location.errorf ?sub ?if_highlight, Ctype.free_vars ?env, Js_implementation ?outputprefix, Js_exp_make.of_block ?e, Compiler_process.run_requests ?poll ?on_complete.
  • Optional arguments every caller supplies become mandatory labelled arguments:
    • Mostly ~loc/~attrs of the Ast_helper0 builders.
    • Plus a few whose None branch was unreachable (Location.pp_ksprintf ~before, Parmatch.do_check_partial ~pred, …).

Kept, marked [@@live] with a comment

  • Read in ways reanalyze can't see:
    • Watch_snapshot.file/dependency and Run_config.snapshot, whose fields are only read by structural equality.
    • Platform_windows.command, read on Windows only. On other platforms the file is only type-checked in the tests.
    • Two forward-reference hooks (Typemod.type_open_, Location.default_error_reporter) and Cmt_format_common.record_deprecated_used.
  • Parts of general APIs that new code is likely to need (removed at first, then restored):
    • the full ANSI palette of Misc.Color, including background colors
    • the Typedtree_iter.Make_iterator entry points (iter_structure, iter_signature, iter_signature_item, iter_module_type, iter_pattern)
    • Ast_helper.Mod.mk

The platform variants of compiler/{core,ext,ml} are now copied with copy#, so the native and playground copies have distinct source positions and reanalyze doesn't merge their declarations.

Running it: make dead-code

scripts/dead_code.sh builds the native and browser profiles and runs reanalyze over both. It fails on any finding, and currently reports 0 issues.

  • Requirements: reanalyze 2.27.0 or later, the first release that analyzes several build trees together. It's on opam (opam install reanalyze). The script uses reanalyze.exe from PATH, or REANALYZE=path/to/reanalyze.exe.
  • Later in the stack: Check for dead code in CI #9246 makes reanalyze a test dependency and runs the check in CI.

What the check deliberately doesn't report:

  • Suppressed:
  • Test-only code: tests are analyzed too, so values used only by tests count as live.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Changelog

🏠 Internal

  • Remove dead code found by running reanalyze's dead code analysis on the OCaml sources of the compiler, build system and editor analysis, including optional arguments that no caller passes, unused fields of the .cmi/.cmt formats and the write-only file dependency tracking of reanalyze.

Semantic Diff

11 commits · Full page

Remove dead compiler, build system and test code found by reanalyze

ebb9114 · cknitt + Claude · Nov 02, 2026, 20:58 UTC

Running reanalyze's dead code analysis over the native and browser (playground) builds reports values, constructors and fields that nothing uses: unused exports of Ext_list, Request_local, Misc.Color, Ast_literal, Ast_fixed_arg, Ast_helper and Ctype, Ast_helper0 builders, the narrowed Typedtree_iter.Make_iterator signature, Lam_id_kind's MutableBlock, Exception and boxed Undefined (with Lambda's Pis_undefined and Js_exp_make.is_undef, which only they produced), Bsc_args actions, Includecore.Field_arity, the hash_string_int primitive and its C stub, two rewatch exception aliases that were only matched, and unused ounit helpers. Fields of serialized formats (.cmi/.cmt) and the frozen parsetree0 stay.

Remove dead editor analysis code and reanalyze's write-only file deps

e75f00a · cknitt + Claude · Nov 02, 2026, 20:58 UTC

Reanalyze finds unused code in the editor analysis and in reanalyze itself: the Reactive.Registry/Scheduler exports, Shared_types helpers, Completion fields type_arg_context and data (with the parameters that only filled them), package.dependencies, Server.let*, the never-produced Circular issue, and record fields of the reactive pipeline that nothing reads. Two reactive collections, file_deps_map and files, were computed but never consumed; they were the only readers of the per-file File_deps builder, so that module and its ~file_deps/~add_file_reference plumbing go as well. package.rescript_version stays: the ve+ test directives set it.

Remove unused fields of the .cmi and .cmt formats

17cf05b · cknitt + Claude · Nov 03, 2026, 06:40 UTC

Reanalyze finds fields of the serialized formats that nothing reads: cmt_comments, cmt_sourcefile, cmt_builddir, cmt_loadpath, cmt_initial_env, cmt_imports and cmt_use_summaries of Cmt_format, deprecated_used.deprecated_text, Types.label_description.lbl_attributes, Typedtree.extension_constructor.ext_name, Primitive.prim_alloc, and the never-built Env_constraints summary. v13 has a new .cmi/.cmt version anyway, and the release bumps the magic numbers. The initial environment only fed cmt_initial_env, so save_cmt and Typemod.save_signature no longer take it.

Remove optional arguments that no caller passes

2c8c04d · cknitt + Claude · Nov 03, 2026, 07:21 UTC

Reanalyze reports optional parameters that are never supplied. The largest group is ?comment in Js_exp_make and Js_stmt_make: only three producers remain (the @__PURE__ annotation on exception creation and the [] and assert_false hints on constants) plus the builders that forward to them, so the generated JavaScript is unchanged. The comment of a tuple field access was always None, so Lambda.str_of_field_info goes too.

The rest are parameters whose default is always taken, such as Location.errorf's ?sub and ?if_highlight, Ctype.free_vars' ?env (with the request-local really_closed it set), Js_implementation's ?outputprefix, Bsc_args.parse_exn's ?finish, and Ast_helper builders' ?runtime_tag, ?runtime_name, ?default and ?suffix. The default is now used directly.

Make optional arguments that every caller supplies mandatory

8955cbd · cknitt + Claude · Nov 03, 2026, 07:40 UTC

Reanalyze reports optional parameters that no call omits. They become labelled arguments, so a default that is never taken no longer suggests otherwise: mostly ~loc and ~attrs of the Ast_helper0 builders used by the frozen-AST mappers (the mk functions included where all builders now pass both), plus a few others such as Location.pp_ksprintf ~before, Parmatch.do_check_partial ~pred and Type_utils.filter_pipeable_functions ~target_type_id, whose None branches were unreachable.

Remove the last dead code and mark fields reanalyze cannot see as live

47ab359 · cknitt + Claude · Nov 03, 2026, 08:03 UTC

The remaining reanalyze findings outside the frozen parsetree0:

- Dead, removed: the playground's int_unsafe_blit; package.rescript_version with Packages.get_rescript_version, the RESCRIPT_VERSION lookup and the ve+/ve- analysis test directives that only set it; and the default enter_expression of Typedtree_iter, which every iterator overrides (Default_iterator_argument now implements IteratorArgumentDefaults, IteratorArgument without enter_expression). - Live, annotated with [@@live] and a comment: Watch_snapshot's file and dependency and Run_config.snapshot, whose fields are only read by structural equality, and Platform_windows.command, read through Platform.command on Windows only.

Also give the playground's Cmt_format_persistence.save_cmt the signature without the initial environment, which the .cmt field removal missed: the call was a partial application, harmless only because the playground writes no .cmt.

Add make dead-code to run reanalyze's dead code analysis

4cfd3fc · cknitt + Claude · Nov 03, 2026, 08:03 UTC

scripts/dead_code.sh builds the native and the browser (playground) profiles and runs reanalyze over both, so uses in either count, and fails on any finding. Vendored flow_parser and the frozen parsetree0 are suppressed. It needs a reanalyze with rescript-lang/reanalyze#224, given as REANALYZE.

Give platform variants distinct source names and mark forward-ref hooks live

be4ea2c · cknitt + Claude · Nov 03, 2026, 19:05 UTC

The native and playground variants of a platform module were copied to the same name, so their .cmt locations shared one source path and reanalyze could not tell their declarations apart (it now warns about that). The copy rules use copy#, whose line directive makes locations name platform/native/... or platform/playground/... instead.

type_open_, default_error_reporter and record_deprecated_used are called through forward references (Typecore.type_open, error_reporter, Cmt_utils.record_deprecated_used) with optional arguments reanalyze cannot trace, so they are marked [@live] with a comment.

Remove code left unused by in-memory build file writes

7fd9bad · cknitt + Claude · Nov 04, 2026, 06:11 UTC

Since #9170 writes build files through Build_file_store, nothing writes or reads them through channels any more. make dead-code reported:

- Misc.output_to_bin_file_directly, Ext_buffer.output_buffer and Cmi_format.read_cmi_channel: never used; removed. - File_util.read_build_file: used only inside File_util; no longer exported. - Compiler_process.run_requests: its ?poll and ?on_complete are never passed (the only caller is a test); removed, like the other never-passed optional arguments.

Remove code that recent master changes left unused

09cd097 · cknitt + Claude · Nov 06, 2026, 20:48 UTC

After rebasing onto master (Rust rewatch removal, flat lib/rescript), master's new code still matched Lambda.Pis_undefined, which this branch removes as never produced, and make dead-code reported:

- Js_exp_make.of_block ?e, and the test helpers' module_ ?interface and publish ?has_interface: never passed; removed. - Cmi_format.input_cmi and Build_session.iter_package_plans: never used. - Package_plan.t.source_files: never read; removed with its two writes.

The two Pis_undefined arms (Lambda, Lam_analysis) go.

Keep the color palette, iterator entry points and Mod.mk as live

98faffc · cknitt + Claude · Nov 06, 2026, 21:01 UTC

The first commit removed what no code used today, including parts of general APIs that new code is likely to need. These come back, marked [@@live] with a comment so the dead-code check accepts them:

- Misc.Color: the full ANSI palette (Black, Green, Blue, White) and background colors (BG), exported again so OCaml's unused-constructor warning does not fire. - Typedtree_iter.Make_iterator: iter_structure, iter_signature, iter_signature_item, iter_module_type and iter_pattern. - Ast_helper.Mod.mk: the builder the other Mod builders specialize.

@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.81699% with 74 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.92%. Comparing base (bf35764) to head (98faffc).

Files with missing lines Patch % Lines
compiler/ml/ast_helper0.ml 63.54% 35 Missing ⚠️
compiler/core/js_exp_make.ml 79.26% 17 Missing ⚠️
compiler/ml/lambda.ml 0.00% 7 Missing ⚠️
compiler/core/js_stmt_make.ml 72.72% 6 Missing ⚠️
compiler/core/lam_pass_remove_alias.ml 0.00% 4 Missing ⚠️
compiler/core/lam_analysis.ml 33.33% 2 Missing ⚠️
compiler/ml/location.ml 60.00% 2 Missing ⚠️
compiler/ml/ctype.ml 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9173      +/-   ##
==========================================
+ Coverage   81.74%   81.92%   +0.18%     
==========================================
  Files         457      456       -1     
  Lines       65713    65471     -242     
==========================================
- Hits        53715    53636      -79     
+ Misses      11998    11835     -163     
Files with missing lines Coverage Δ
analysis/reanalyze/src/dce_file_processing.ml 94.44% <100.00%> (-0.56%) ⬇️
analysis/reanalyze/src/dead_common.ml 96.47% <ø> (+0.68%) ⬆️
analysis/reanalyze/src/dead_exception.ml 100.00% <100.00%> (ø)
analysis/reanalyze/src/dead_value.ml 85.83% <100.00%> (-0.07%) ⬇️
analysis/reanalyze/src/log_.ml 68.37% <ø> (+1.14%) ⬆️
analysis/reanalyze/src/reactive_coercions.ml 95.83% <100.00%> (ø)
analysis/reanalyze/src/reactive_exception_refs.ml 71.42% <100.00%> (ø)
analysis/reanalyze/src/reactive_merge.ml 96.55% <ø> (-0.82%) ⬇️
analysis/reanalyze/src/reactive_type_deps.ml 83.75% <ø> (ø)
analysis/reanalyze/src/reanalyze_server.ml 0.56% <ø> (+<0.01%) ⬆️
... and 69 more
🚀 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.

@pkg-pr-new

pkg-pr-new Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

rescript

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

@rescript/belt

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

@rescript/darwin-arm64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: 98faffc

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

@cknitt

cknitt commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T06:08:33.575110Z 9ba9825 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. Delightful!

Reviewed commit: 9ba98259dc

ℹ️ 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".

@cknitt
cknitt marked this pull request as ready for review November 7, 2026 06:16
@cknitt
cknitt requested a review from cristianoc November 7, 2026 06:16
cknitt and others added 11 commits November 7, 2026 18:47
Running reanalyze's dead code analysis over the native and browser
(playground) builds reports values, constructors and fields that nothing
uses: unused exports of Ext_list, Request_local, Misc.Color, Ast_literal,
Ast_fixed_arg, Ast_helper and Ctype, Ast_helper0 builders, the narrowed
Typedtree_iter.Make_iterator signature, Lam_id_kind's MutableBlock,
Exception and boxed Undefined (with Lambda's Pis_undefined and
Js_exp_make.is_undef, which only they produced), Bsc_args actions,
Includecore.Field_arity, the hash_string_int primitive and its C stub,
two rewatch exception aliases that were only matched, and unused ounit
helpers. Fields of serialized formats (.cmi/.cmt) and the frozen
parsetree0 stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT
Signed-off-by: Christoph Knittel <ck@cca.io>
Reanalyze finds unused code in the editor analysis and in reanalyze
itself: the Reactive.Registry/Scheduler exports, Shared_types helpers,
Completion fields type_arg_context and data (with the parameters that
only filled them), package.dependencies, Server.let*, the never-produced
Circular issue, and record fields of the reactive pipeline that nothing
reads. Two reactive collections, file_deps_map and files, were computed
but never consumed; they were the only readers of the per-file
File_deps builder, so that module and its ~file_deps/~add_file_reference
plumbing go as well. package.rescript_version stays: the ve+ test
directives set it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT
Signed-off-by: Christoph Knittel <ck@cca.io>
Reanalyze finds fields of the serialized formats that nothing reads:
cmt_comments, cmt_sourcefile, cmt_builddir, cmt_loadpath,
cmt_initial_env, cmt_imports and cmt_use_summaries of Cmt_format,
deprecated_used.deprecated_text, Types.label_description.lbl_attributes,
Typedtree.extension_constructor.ext_name, Primitive.prim_alloc, and the
never-built Env_constraints summary. v13 has a new .cmi/.cmt version
anyway, and the release bumps the magic numbers. The initial environment
only fed cmt_initial_env, so save_cmt and Typemod.save_signature no longer
take it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT
Signed-off-by: Christoph Knittel <ck@cca.io>
Reanalyze reports optional parameters that are never supplied. The
largest group is ?comment in Js_exp_make and Js_stmt_make: only three
producers remain (the @__PURE__ annotation on exception creation and the
[] and assert_false hints on constants) plus the builders that forward
to them, so the generated JavaScript is unchanged. The comment of a tuple
field access was always None, so Lambda.str_of_field_info goes too.

The rest are parameters whose default is always taken, such as
Location.errorf's ?sub and ?if_highlight, Ctype.free_vars' ?env (with
the request-local really_closed it set), Js_implementation's
?outputprefix, Bsc_args.parse_exn's ?finish, and Ast_helper builders'
?runtime_tag, ?runtime_name, ?default and ?suffix. The default is now
used directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT
Signed-off-by: Christoph Knittel <ck@cca.io>
Reanalyze reports optional parameters that no call omits. They become
labelled arguments, so a default that is never taken no longer suggests
otherwise: mostly ~loc and ~attrs of the Ast_helper0 builders used by the
frozen-AST mappers (the mk functions included where all builders now pass
both), plus a few others such as Location.pp_ksprintf ~before,
Parmatch.do_check_partial ~pred and Type_utils.filter_pipeable_functions
~target_type_id, whose None branches were unreachable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT
Signed-off-by: Christoph Knittel <ck@cca.io>
The remaining reanalyze findings outside the frozen parsetree0:

- Dead, removed: the playground's int_unsafe_blit; package.rescript_version
  with Packages.get_rescript_version, the RESCRIPT_VERSION lookup and the
  ve+/ve- analysis test directives that only set it; and the default
  enter_expression of Typedtree_iter, which every iterator overrides
  (Default_iterator_argument now implements IteratorArgumentDefaults,
  IteratorArgument without enter_expression).
- Live, annotated with [@@LiVe] and a comment: Watch_snapshot's file and
  dependency and Run_config.snapshot, whose fields are only read by
  structural equality, and Platform_windows.command, read through
  Platform.command on Windows only.

Also give the playground's Cmt_format_persistence.save_cmt the signature
without the initial environment, which the .cmt field removal missed:
the call was a partial application, harmless only because the playground
writes no .cmt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT
Signed-off-by: Christoph Knittel <ck@cca.io>
scripts/dead_code.sh builds the native and the browser (playground)
profiles and runs reanalyze over both, so uses in either count, and fails
on any finding. Vendored flow_parser and the frozen parsetree0 are
suppressed. It needs a reanalyze with rescript-lang/reanalyze#224, given
as REANALYZE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT
Signed-off-by: Christoph Knittel <ck@cca.io>
…ks live

The native and playground variants of a platform module were copied to
the same name, so their .cmt locations shared one source path and
reanalyze could not tell their declarations apart (it now warns about
that). The copy rules use copy#, whose line directive makes locations name
platform/native/... or platform/playground/... instead.

type_open_, default_error_reporter and record_deprecated_used are called
through forward references (Typecore.type_open, error_reporter,
Cmt_utils.record_deprecated_used) with optional arguments reanalyze
cannot trace, so they are marked [@LiVe] with a comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT
Signed-off-by: Christoph Knittel <ck@cca.io>
Since #9170 writes build files through Build_file_store, nothing writes
or reads them through channels any more. make dead-code reported:

- Misc.output_to_bin_file_directly, Ext_buffer.output_buffer and
  Cmi_format.read_cmi_channel: never used; removed.
- File_util.read_build_file: used only inside File_util; no longer
  exported.
- Compiler_process.run_requests: its ?poll and ?on_complete are never
  passed (the only caller is a test); removed, like the other
  never-passed optional arguments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT
Signed-off-by: Christoph Knittel <ck@cca.io>
After rebasing onto master (Rust rewatch removal, flat lib/rescript),
master's new code still matched Lambda.Pis_undefined, which this branch
removes as never produced, and make dead-code reported:

- Js_exp_make.of_block ?e, and the test helpers' module_ ?interface and
  publish ?has_interface: never passed; removed.
- Cmi_format.input_cmi and Build_session.iter_package_plans: never used.
- Package_plan.t.source_files: never read; removed with its two writes.

The two Pis_undefined arms (Lambda, Lam_analysis) go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT
Signed-off-by: Christoph Knittel <ck@cca.io>
The first commit removed what no code used today, including parts of
general APIs that new code is likely to need. These come back, marked
[@@LiVe] with a comment so the dead-code check accepts them:

- Misc.Color: the full ANSI palette (Black, Green, Blue, White) and
  background colors (BG), exported again so OCaml's unused-constructor
  warning does not fire.
- Typedtree_iter.Make_iterator: iter_structure, iter_signature,
  iter_signature_item, iter_module_type and iter_pattern.
- Ast_helper.Mod.mk: the builder the other Mod builders specialize.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt
cknitt force-pushed the remove-dead-code-reanalyze branch from 9ba9825 to 98faffc Compare November 7, 2026 18:57
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

✅ Compiler benchmarks

Allocated words

In total: 456,989,425 → 456,745,704 (-0.05%).

Benchmark Base Head Change
packages/@rescript/runtime/Stdlib.res 1,468,277 1,462,928 -0.36%
packages/@rescript/belt/src/Belt.res 667,341 665,608 -0.26%
packages/@rescript/runtime/JsxDOM.res 3,314,709 3,309,263 -0.16%
packages/@rescript/runtime/JsxDOMStyle.res 2,517,375 2,513,455 -0.16%
packages/@rescript/belt/src/Belt_HashSet.resi 705,390 704,337 -0.15%
packages/@rescript/runtime/Stdlib_Temporal.res 701,948 700,943 -0.14%
packages/@rescript/belt/src/Belt_internalSetBuckets.resi 679,586 678,624 -0.14%
packages/@rescript/belt/src/Belt_internalBucketsType.resi 644,590 643,690 -0.14%
packages/@rescript/belt/src/Belt_Int.resi 627,830 626,956 -0.14%
packages/@rescript/belt/src/Belt_Float.resi 629,309 628,433 -0.14%
72 more changes
Benchmark Base Head Change
packages/@rescript/belt/src/Belt_Float.res 645,076 644,181 -0.14%
packages/@rescript/belt/src/Belt_Int.res 645,510 644,616 -0.14%
packages/@rescript/belt/src/Belt_internalBuckets.resi 712,893 711,924 -0.14%
packages/@rescript/belt/src/Belt_internalBucketsType.res 777,633 776,584 -0.13%
packages/@rescript/belt/src/Belt_HashMap.resi 781,990 780,938 -0.13%
packages/@rescript/belt/src/Belt_SortArray.resi 734,854 733,874 -0.13%
packages/@rescript/belt/src/Belt_SortArrayString.resi 648,659 647,808 -0.13%
packages/@rescript/belt/src/Belt_SortArrayInt.resi 648,783 647,932 -0.13%
packages/@rescript/belt/src/Belt_MutableStack.resi 648,574 647,724 -0.13%
packages/@rescript/belt/src/Belt_HashSetInt.resi 654,610 653,758 -0.13%
packages/@rescript/belt/src/Belt_HashSetString.resi 654,491 653,640 -0.13%
packages/@rescript/belt/src/Belt_Range.resi 655,345 654,495 -0.13%
packages/@rescript/belt/src/Belt_Range.res 780,043 779,046 -0.13%
packages/@rescript/runtime/Stdlib_Intl.res 652,133 651,308 -0.13%
packages/@rescript/belt/src/Belt_MutableQueue.resi 687,739 686,888 -0.12%
packages/@rescript/belt/src/Belt_HashMapString.resi 694,668 693,818 -0.12%
packages/@rescript/belt/src/Belt_HashMapInt.resi 694,789 693,939 -0.12%
packages/@rescript/belt/src/Belt_internalSetBuckets.res 1,239,575 1,238,065 -0.12%
packages/@rescript/belt/src/Belt_Set.resi 926,931 925,808 -0.12%
packages/@rescript/belt/src/Belt_MutableSet.resi 885,936 884,882 -0.12%
packages/@rescript/belt/src/Belt_MutableMap.resi 886,344 885,291 -0.12%
packages/@rescript/belt/src/Belt_Option.res 885,745 884,693 -0.12%
packages/@rescript/runtime/Stdlib_Temporal_ZonedDateTime.res 1,060,605 1,059,346 -0.12%
packages/@rescript/belt/src/Belt_Option.resi 724,391 723,538 -0.12%
packages/@rescript/runtime/Stdlib_Temporal_PlainMonthDay.res 749,204 748,326 -0.12%
packages/@rescript/belt/src/Belt_Result.resi 726,130 725,280 -0.12%
packages/@rescript/runtime/Stdlib_Temporal_PlainYearMonth.res 865,691 864,681 -0.12%
packages/@rescript/belt/src/Belt_Id.res 775,865 774,964 -0.12%
packages/@rescript/belt/src/Belt_Id.resi 740,534 739,677 -0.12%
packages/@rescript/runtime/Stdlib_Temporal_Instant.res 788,857 787,946 -0.12%
packages/@rescript/belt/src/Belt_SetString.resi 740,483 739,633 -0.11%
packages/@rescript/belt/src/Belt_SetInt.resi 740,616 739,767 -0.11%
packages/@rescript/runtime/Stdlib_Int.res 953,023 951,931 -0.11%
packages/@rescript/belt/src/Belt_MutableStack.res 893,146 892,123 -0.11%
packages/@rescript/belt/src/Belt_MutableSetString.resi 745,749 744,897 -0.11%
packages/@rescript/belt/src/Belt_MutableSetInt.resi 745,871 745,019 -0.11%
packages/@rescript/runtime/RescriptTools_Docgen.res 769,841 768,969 -0.11%
packages/@rescript/runtime/Stdlib_Temporal_PlainTime.res 801,292 800,386 -0.11%
packages/@rescript/belt/src/Belt_internalAVLset.resi 849,821 848,865 -0.11%
packages/@rescript/runtime/Stdlib_Intl_DateTimeFormat.res 875,253 874,270 -0.11%
packages/@rescript/runtime/Stdlib_String.res 1,010,067 1,008,933 -0.11%
packages/@rescript/runtime/RescriptTools_Docgen.resi 759,438 758,590 -0.11%
packages/@rescript/runtime/Stdlib_Temporal_PlainDate.res 885,809 884,824 -0.11%
packages/@rescript/belt/src/Belt_Set.res 1,419,186 1,417,614 -0.11%
packages/@rescript/runtime/RescriptTools_ExtractCodeBlocks.res 589,533 588,882 -0.11%
packages/@rescript/belt/src/Belt_HashSetInt.res 1,412,456 1,410,905 -0.11%
packages/@rescript/runtime/Stdlib_Temporal_PlainDateTime.res 920,419 919,409 -0.11%
packages/@rescript/belt/src/Belt_HashSetString.res 1,412,763 1,411,216 -0.11%
packages/@rescript/belt/src/Belt_HashSet.res 1,573,656 1,571,939 -0.11%
packages/@rescript/belt/src/Belt_Result.res 920,631 919,637 -0.11%
packages/@rescript/belt/src/Belt_Map.res 1,561,134 1,559,456 -0.11%
packages/@rescript/belt/src/Belt_MutableMapString.resi 799,083 798,231 -0.11%
packages/@rescript/belt/src/Belt_MutableMapInt.resi 799,206 798,356 -0.11%
packages/@rescript/runtime/Stdlib_Intl_NumberFormat.res 891,600 890,653 -0.11%
packages/@rescript/belt/src/Belt_internalBuckets.res 1,556,445 1,554,799 -0.11%
packages/@rescript/belt/src/Belt_internalSetInt.res 1,267,668 1,266,336 -0.11%
packages/@rescript/belt/src/Belt_internalSetString.res 1,268,854 1,267,521 -0.11%
packages/@rescript/belt/src/Belt_Map.resi 1,076,538 1,075,417 -0.10%
packages/@rescript/belt/src/Belt_SetDict.resi 892,770 891,846 -0.10%
packages/@rescript/runtime/Stdlib_Date.res 1,057,120 1,056,047 -0.10%
packages/@rescript/runtime/Stdlib_BigUint64Array.res 823,371 822,538 -0.10%
packages/@rescript/runtime/Stdlib_Uint8ClampedArray.res 823,656 822,823 -0.10%
packages/@rescript/runtime/Stdlib_Int32Array.res 823,270 822,438 -0.10%
packages/@rescript/runtime/Stdlib_BigInt64Array.res 823,297 822,465 -0.10%
packages/@rescript/runtime/Stdlib_Int8Array.res 823,122 822,291 -0.10%
packages/@rescript/runtime/Stdlib_Uint8Array.res 823,137 822,306 -0.10%
packages/@rescript/runtime/Stdlib_Float32Array.res 823,235 822,404 -0.10%
packages/@rescript/runtime/Stdlib_Float64Array.res 823,235 822,404 -0.10%
packages/@rescript/runtime/Stdlib_Int16Array.res 823,269 822,438 -0.10%
packages/@rescript/runtime/Stdlib_Uint16Array.res 823,276 822,445 -0.10%
packages/@rescript/runtime/Stdlib_Uint32Array.res 823,276 822,445 -0.10%
packages/@rescript/belt/src/Belt_internalAVLtree.resi 958,863 957,898 -0.10%

Instructions

In total: 10,226,962,471 → 10,228,138,954 (+0.01%).

Benchmark Base Head Change
packages/@rescript/runtime/JsxDOM.res 143,848,100 142,783,397 -0.74%
stress/ObjectFields.res 957,097,762 961,161,941 +0.42%
packages/@rescript/runtime/JsxDOMStyle.res 119,996,626 119,823,248 -0.14%
packages/@rescript/runtime/Stdlib_String.resi 52,393,982 52,332,691 -0.12%
packages/@rescript/runtime/Stdlib_Temporal_PlainDate.res 46,996,482 46,946,912 -0.11%
packages/@rescript/runtime/Stdlib_Temporal_PlainDateTime.res 48,434,807 48,385,864 -0.10%

Pull request 98faffc compared with base bf35764 in this run.

@cknitt
cknitt requested a review from fhammerschmidt November 8, 2026 19:44

This branch has not been deployed

No deployments
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.

1 participant