Skip to content

Remove dead code: js_stdout, gentype Curry import, toplevel entry point and more - #9146

Merged
cknitt merged 7 commits into
masterfrom
remove-dead-code-2
Oct 31, 2026
Merged

cknitt merged 7 commits into
masterfrom
remove-dead-code-2

Conversation

@cknitt

@cknitt cknitt commented Oct 30, 2026

Copy link
Copy Markdown
Member

Removes dead code found in a repo-wide cleanup survey. Each commit removes one thing, and none changes compiler output.

  • js_stdout: Js_config.js_stdout starts as ref true and nothing writes it, so the two && !js_stdout tests always passed.
  • gentype Curry import: emit_import_curry is never set, so gentype never imported curry.js, which the runtime no longer ships. The import path, platform_lib and Module_name.curry go with it.
  • Analysis type cache: Shared.type_to_string only read its cache when cache_type_to_string was set, which nothing does, yet it still stored every printed type, keyed by a type_expr.
  • @uncurry / Js.Fn: editor completion still suggested @uncurry, which the compiler no longer recognises. Hover and references still checked for Js.Fn.arityN types, which no longer exist.
  • OCaml toplevel entry point: Typemod.type_toplevel_phrase was the only caller passing ~toplevel:true, so the ?toplevel parameters of type_structure, type_open and Env.open_signature always took their default. The outcome printer test now uses Typemod.type_structure.
  • Commented-out OCaml code: debug printers in parmatch.ml and switch.ml, newmarkedvar and check_expans in btype, and Clflags.recursive_types remnants in typedecl and ctype.
  • Otyp_attribute: never constructed; only the outcome printer matched it.

Changelog: a polish fragment for the @uncurry completion and an internal fragment for the rest.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kbf3gKyiYMf54wPRxFdUWe

cknitt and others added 7 commits October 30, 2026 20:18
Js_config.js_stdout starts as `ref true` and nothing writes it, so the
two `&& !js_stdout` tests are always true.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gKyiYMf54wPRxFdUWe
Signed-off-by: Christoph Knittel <ck@cca.io>
emit_import_curry is never set to true, so gentype never imports
curry.js (which the runtime no longer has). The flag, the import path,
platform_lib and Module_name.curry go with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gKyiYMf54wPRxFdUWe
Signed-off-by: Christoph Knittel <ck@cca.io>
Shared.type_to_string read its cache only when cache_type_to_string was
set, which nothing does, but stored every printed type in it, keyed by
a type_expr that a hash collision would compare structurally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gKyiYMf54wPRxFdUWe
Signed-off-by: Christoph Knittel <ck@cca.io>
The compiler no longer recognises `@uncurry`, and the `Js.Fn.arityN`
types that is_uncurried_internal looked for are gone from the runtime,
so hover and references never took those branches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gKyiYMf54wPRxFdUWe
Signed-off-by: Christoph Knittel <ck@cca.io>
type_toplevel_phrase, left over from the OCaml REPL, was the only
caller passing `~toplevel:true`, so the `?toplevel` parameters of
type_structure, type_open and Env.open_signature always took their
default. The outcome printer test types its file with type_structure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gKyiYMf54wPRxFdUWe
Signed-off-by: Christoph Knittel <ck@cca.io>
Debug printers in parmatch.ml and switch.ml, newmarkedvar and
check_expans in btype, and the Clflags.recursive_types remnants in
typedecl and ctype were all commented out; print_pat still matched
Tpat_lazy, which no longer exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gKyiYMf54wPRxFdUWe
Signed-off-by: Christoph Knittel <ck@cca.io>
Nothing constructs Otyp_attribute; only the outcome printer matched it.
The commit also adds the changelog fragment for this dead-code cleanup.

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

Copy link
Copy Markdown

Changelog

💅 Polish

  • Stop suggesting the @uncurry decorator in editor completion; the compiler no longer supports it.

🏠 Internal

  • Remove dead code: the js_stdout flag, gentype's Curry import path, an unused analysis type cache, the OCaml toplevel entry point, commented-out OCaml code and the unused Otyp_attribute outcome node.

Semantic Diff

7 commits · Full page

Remove the js_stdout flag, which is always true

e443be6 · cknitt + Claude · Oct 30, 2026, 20:18 UTC

Js_config.js_stdout starts as ref true and nothing writes it, so the two && !js_stdout tests are always true.

Remove gentype's Curry import path

b6e4b04 · cknitt + Claude · Oct 30, 2026, 20:29 UTC

emit_import_curry is never set to true, so gentype never imports curry.js (which the runtime no longer has). The flag, the import path, platform_lib and Module_name.curry go with it.

Stop storing every printed type in an unused analysis cache

0bfb53e · cknitt + Claude · Oct 30, 2026, 20:31 UTC

Shared.type_to_string read its cache only when cache_type_to_string was set, which nothing does, but stored every printed type in it, keyed by a type_expr that a hash collision would compare structurally.

Stop suggesting @uncurry and checking for Js.Fn arity types in analysis

1a956ea · cknitt + Claude · Oct 30, 2026, 20:32 UTC

The compiler no longer recognises @uncurry, and the Js.Fn.arityN types that is_uncurried_internal looked for are gone from the runtime, so hover and references never took those branches.

Remove the OCaml toplevel phrase entry point from Typemod

5e0e797 · cknitt + Claude · Oct 30, 2026, 20:33 UTC

type_toplevel_phrase, left over from the OCaml REPL, was the only caller passing ~toplevel:true, so the ?toplevel parameters of type_structure, type_open and Env.open_signature always took their default. The outcome printer test types its file with type_structure.

Delete commented-out OCaml code in the type checker and match compiler

9500dac · cknitt + Claude · Oct 30, 2026, 20:34 UTC

Debug printers in parmatch.ml and switch.ml, newmarkedvar and check_expans in btype, and the Clflags.recursive_types remnants in typedecl and ctype were all commented out; print_pat still matched Tpat_lazy, which no longer exists.

Remove the Otyp_attribute outcome tree node

5f1c99b · cknitt + Claude · Oct 30, 2026, 20:34 UTC

Nothing constructs Otyp_attribute; only the outcome printer matched it. The commit also adds the changelog fragment for this dead-code cleanup.

@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.74%. Comparing base (7249c11) to head (5f1c99b).

Files with missing lines Patch % Lines
compiler/ml/env.ml 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9146      +/-   ##
==========================================
+ Coverage   81.73%   81.74%   +0.01%     
==========================================
  Files         460      460              
  Lines       64936    64903      -33     
==========================================
- Hits        53076    53057      -19     
+ Misses      11860    11846      -14     
Files with missing lines Coverage Δ
analysis/src/hover.ml 77.48% <ø> (+0.35%) ⬆️
analysis/src/references.ml 67.94% <ø> (+0.01%) ⬆️
analysis/src/shared.ml 68.42% <100.00%> (+0.23%) ⬆️
analysis/src/utils.ml 47.79% <ø> (-0.33%) ⬇️
compiler/common/js_config.ml 81.81% <ø> (ø)
compiler/core/lam_compile_main.ml 95.93% <100.00%> (-0.04%) ⬇️
compiler/core/lam_compile_primitive.ml 81.25% <100.00%> (-0.12%) ⬇️
compiler/gentype/emit_js.ml 79.76% <ø> (+0.54%) ⬆️
compiler/gentype/gentype_config.ml 77.27% <ø> (+4.41%) ⬆️
compiler/gentype/import_path.ml 80.00% <ø> (+2.22%) ⬆️
... and 9 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 Oct 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

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

@rescript/belt

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

@rescript/darwin-arm64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: 5f1c99b

@github-actions

Copy link
Copy Markdown

@cknitt

cknitt commented Oct 31, 2026

Copy link
Copy Markdown
Member Author

@codex review

@cknitt
cknitt marked this pull request as ready for review October 31, 2026 05:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 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-31T06:00:40.711341Z 5f1c99b 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: 5f1c99b684

ℹ️ 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 31, 2026 06:07
@cknitt
cknitt requested a review from cristianoc October 31, 2026 06:08

@cristianoc cristianoc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still curry around?
incredible

@cknitt
cknitt merged commit f2204b1 into master Oct 31, 2026
26 checks passed
@cknitt
cknitt deleted the remove-dead-code-2 branch October 31, 2026 06:28
aspeddro pushed a commit to aspeddro/rescript-compiler that referenced this pull request Oct 31, 2026
…nt and more (rescript-lang#9146)

* Remove the js_stdout flag, which is always true

Js_config.js_stdout starts as `ref true` and nothing writes it, so the
two `&& !js_stdout` tests are always true.

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

* Remove gentype's Curry import path

emit_import_curry is never set to true, so gentype never imports
curry.js (which the runtime no longer has). The flag, the import path,
platform_lib and Module_name.curry go with it.

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

* Stop storing every printed type in an unused analysis cache

Shared.type_to_string read its cache only when cache_type_to_string was
set, which nothing does, but stored every printed type in it, keyed by
a type_expr that a hash collision would compare structurally.

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

* Stop suggesting @uncurry and checking for Js.Fn arity types in analysis

The compiler no longer recognises `@uncurry`, and the `Js.Fn.arityN`
types that is_uncurried_internal looked for are gone from the runtime,
so hover and references never took those branches.

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

* Remove the OCaml toplevel phrase entry point from Typemod

type_toplevel_phrase, left over from the OCaml REPL, was the only
caller passing `~toplevel:true`, so the `?toplevel` parameters of
type_structure, type_open and Env.open_signature always took their
default. The outcome printer test types its file with type_structure.

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

* Delete commented-out OCaml code in the type checker and match compiler

Debug printers in parmatch.ml and switch.ml, newmarkedvar and
check_expans in btype, and the Clflags.recursive_types remnants in
typedecl and ctype were all commented out; print_pat still matched
Tpat_lazy, which no longer exists.

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

* Remove the Otyp_attribute outcome tree node

Nothing constructs Otyp_attribute; only the outcome printer matched it.
The commit also adds the changelog fragment for this dead-code cleanup.

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

---------

Signed-off-by: Christoph Knittel <ck@cca.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Pedro Castro <aspeddro@gmail.com>
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