Skip to content

Remove dead code, stale comments and unused test inputs - #8991

Merged
cknitt merged 1 commit into
masterfrom
drift-8977-dead-code
Oct 23, 2026
Merged

cknitt merged 1 commit into
masterfrom
drift-8977-dead-code

Conversation

@cknitt

@cknitt cknitt commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Fixes #8977.

This removes the leftovers the issue lists:

  • .cmt code for the embedded .cmi. Cmi_format.output_cmi had no caller and is removed. The comment on create_cmi no longer says save_cmt calls it. cmt_interface_digest was always None and never read, so the field is removed; the .cmt magic number moves from T047 to T048 because the marshalled record changes. Cmt_format.read no longer tries to read a cmt after an embedded cmi, which the earlier magic bumps made unreachable, and the docs in cmt_format.mli/cmt_format_common.ml no longer promise that older layouts are read.
  • Oprint.out_type_extension, and the Res_outcome_printer function that only set it, are removed.
  • Ext_namespace.try_split_module_name, and its ounit case, are removed.
  • Ast_untagged_variants.block_type_can_be_undefined is removed.
  • The comment on Ast_helper.Jsx_component.take now says that the JSX transform takes a payload on a lone @react.componentWithProps with a deprecation warning (Accept a payload on @react.componentWithProps with a deprecation warning #8944) and rejects the other leftovers.
  • Unused test inputs: tests/build_tests/regexp_statement_formatting/rescript.json, tests/build_tests/option_transitive_dependency/rescript.json (both tests run bsc with explicit flags) and rewatch-ocaml/tests/failure/Broken.invalid (only Broken.fixed is read).
  • Older leftovers: the (*TODO: add +10*) in bsc_warnings.ml, which refers to a removed warning, and the empty compiler/bsc/rescript_compiler_main.mli.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xk6AeCYpCK4SZRtHYKHGoe

Why:
    Recent removals left definitions without callers, which no warning
    reports because they are exported or in a module without an interface:
    Cmi_format.output_cmi, the always-None cmt_interface_digest, the read of
    a cmt after an embedded cmi (unreachable since the magic bumps of #8805
    and #8928), Oprint.out_type_extension, Ext_namespace.try_split_module_name
    and Ast_untagged_variants.block_type_can_be_undefined. Comments that
    promised older .cmt layouts, a JSX transform rejection that #8944 made a
    deprecation, and a TODO for a removed warning are corrected, and the
    empty rescript_compiler_main.mli and three unused test inputs removed.

Review: Why does the cmt magic number change? Removing cmt_interface_digest changes the marshalled cmt_infos record, so .cmt files of the previous layout must be rejected rather than misread: T047 becomes T048.

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

Copy link
Copy Markdown

Semantic Diff

1 commit · Full page

Remove dead code, stale comments and unused test inputs

8427be4 · Christoph Knittel with Claude Opus 5.5 · Oct 23, 2026

Why

Recent removals left definitions without callers, which no warning reports because they are exported or in a module without an interface: Cmi_format.output_cmi, the always-None cmt_interface_digest, the read of a cmt after an embedded cmi (unreachable since the magic bumps of #8805 and #8928), Oprint.out_type_extension, Ext_namespace.try_split_module_name and Ast_untagged_variants.block_type_can_be_undefined. Comments that promised older .cmt layouts, a JSX transform rejection that #8944 made a deprecation, and a TODO for a removed warning are corrected, and the empty rescript_compiler_main.mli and three unused test inputs removed.

Review

  • Why does the cmt magic number change? Removing cmt_interface_digest changes the marshalled cmt_infos record, so .cmt files of the previous layout must be rejected rather than misread: T047 becomes T048.

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.24%. Comparing base (9e2f371) to head (8427be4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8991      +/-   ##
==========================================
+ Coverage   81.22%   81.24%   +0.01%     
==========================================
  Files         457      457              
  Lines       63862    63833      -29     
==========================================
- Hits        51875    51862      -13     
+ Misses      11987    11971      -16     
Files with missing lines Coverage Δ
compiler/ext/config.ml 100.00% <ø> (ø)
compiler/ext/ext_namespace.ml 90.90% <ø> (-1.40%) ⬇️
compiler/ml/ast_helper.ml 88.21% <ø> (ø)
compiler/ml/ast_untagged_variants.ml 88.09% <ø> (+0.88%) ⬆️
compiler/ml/cmi_format.ml 75.55% <ø> (+10.17%) ⬆️
compiler/ml/cmt_format_common.ml 81.81% <100.00%> (+4.76%) ⬆️
compiler/ml/oprint.ml 0.00% <ø> (ø)
compiler/syntax/src/res_outcome_printer.ml 81.83% <ø> (+0.36%) ⬆️
tests/ounit_tests/ounit_string_tests.ml 93.24% <ø> (-0.31%) ⬇️
🚀 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 Oct 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

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

@rescript/belt

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

@rescript/darwin-arm64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: 8427be4

@github-actions

Copy link
Copy Markdown

@cknitt
cknitt marked this pull request as ready for review October 23, 2026 09:25
@cknitt

cknitt commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-23T09:27:33.388864Z 8427be4 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.

@cknitt
cknitt requested a review from cristianoc October 23, 2026 09:26
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 8427be4c96

ℹ️ 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 enabled auto-merge (squash) October 23, 2026 09:28
@cknitt
cknitt merged commit 98f5d69 into master Oct 23, 2026
26 checks passed
@cknitt
cknitt deleted the drift-8977-dead-code branch October 23, 2026 10:53
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.

Dead code, stale comments and unused test inputs left by recent changes

2 participants