Skip to content

Fold the outcome printer into typing and drop the startup hooks - #9380

Open
cknitt wants to merge 1 commit into
layout-single-user-movesfrom
layout-outcome-printer
Open

cknitt wants to merge 1 commit into
layout-single-user-movesfrom
layout-outcome-printer

Conversation

@cknitt

@cknitt cknitt commented Nov 22, 2026

Copy link
Copy Markdown
Member

The type checker printed types and signatures through Oprint: four refs that failed until Res_outcome_printer.setup filled them. It also reached three more modules through refs that Bs_conditional_initial set at startup:

  • the ReScript pattern printer;
  • the polymorphic variant identifier printer;
  • the polymorphic variant match compiler.

These hooks existed because the modules sat in libraries above the type checker. Now that typing links the printer library, the type checker calls them directly:

  • Outcome printer: Res_outcome_printer moves from outcome_printer into typing, and Printtyp calls it. Oprint, Res_outcome_printer.setup and the outcome_printer library are gone.
  • Direct calls:
    • Parmatch calls Pattern_printer.
    • Printtyp calls Res_printer.polyvar_ident_to_string.
    • Matching calls Polyvar_pattern_match.
  • Dead code removed: Matching's never-used default implementations, its as_interval, and Switch.test_sequence, which only those defaults used.
  • Ctype.variant_is_subtype is a function instead of a ref filled with Matching_polyfill.variant_is_subtype.
    • Its body moves into Ctype, checking the base type with Ctype's own helpers, since Typeopt depends on Ctype.
    • get_unboxed_type_representation moves up, unchanged, to precede it.
    • Matching_polyfill is gone.
  • What's left of Bs_conditional_initial: the hooks that can't be direct calls, the .cmi loader and the build file store, which tests replace. It moves into typing.

Output is unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QchYQ7itFLVLUmZ368okjH

@cknitt
cknitt added this pull request to stack #9383 November 22, 2026 07:30
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Changelog

No changelog entry.

Semantic Diff

1 commit · Full page

Fold the outcome printer into typing and drop the startup hooks

dffeec9 · cknitt + Claude · Nov 22, 2026, 07:23 UTC

The type checker printed types and signatures through Oprint, four refs that failed until Res_outcome_printer.setup filled them, and called the ReScript pattern printer, the polymorphic variant printer and the polymorphic variant match compiler through refs that Bs_conditional_initial set at startup. The hooks existed because those modules sat in libraries above the type checker. Now that typing links the printer library, they can be called directly:

- Res_outcome_printer moves from outcome_printer into typing, and Printtyp calls it. Oprint, Res_outcome_printer.setup and the outcome_printer library are gone. - Parmatch calls Pattern_printer, Printtyp calls Res_printer.polyvar_ident_to_string, and Matching calls Polyvar_pattern_match. Matching's unused default implementations, its as_interval and Switch.test_sequence, which only they used, are removed. - Ctype.variant_is_subtype is a function instead of a ref filled with Matching_polyfill.variant_is_subtype. Its body moves into Ctype, checking the base type with Ctype's own helpers, since Typeopt depends on Ctype; get_unboxed_type_representation moves up, unchanged, to precede it. - Bs_conditional_initial keeps the hooks that can't be direct calls (the .cmi loader and the build file store, which tests replace) and moves into typing.

Output is unchanged.

@cknitt cknitt added the changelog:skip No release notes needed label Nov 22, 2026
@cknitt

cknitt commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 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-22T07:51:14.590065Z dffeec9 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. Swish!

Reviewed commit: 15d7218da2

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

@codecov

codecov Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.41379% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.22%. Comparing base (dc052b4) to head (dffeec9).

Files with missing lines Patch % Lines
compiler/typing/ctype.ml 63.15% 14 Missing ⚠️
compiler/typing/printtyp.ml 86.66% 2 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                      @@
##           layout-single-user-moves    #9380      +/-   ##
============================================================
+ Coverage                     82.20%   82.22%   +0.02%     
============================================================
  Files                           463      461       -2     
  Lines                         65771    65757      -14     
============================================================
+ Hits                          54066    54068       +2     
+ Misses                        11705    11689      -16     
Files with missing lines Coverage Δ
compiler/bsc/rescript_compiler_driver.ml 80.71% <ø> (-0.21%) ⬇️
compiler/typing/bs_conditional_initial.ml 100.00% <100.00%> (ø)
compiler/typing/matching.ml 78.50% <100.00%> (+0.58%) ⬆️
compiler/typing/parmatch.ml 77.80% <100.00%> (+0.06%) ⬆️
compiler/typing/res_outcome_printer.ml 83.73% <ø> (ø)
compiler/typing/switch.ml 94.26% <ø> (+2.30%) ⬆️
compiler/typing/printtyp.ml 73.29% <86.66%> (+0.15%) ⬆️
compiler/typing/ctype.ml 70.42% <63.15%> (-0.16%) ⬇️
🚀 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.

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

✅ Compiler benchmarks

Allocated words

In total: 636,570,609 → 636,559,570 (±0.00%).

Generated projects: 629,021,426 → 629,022,510 (±0.00%).

None of the 265 benchmarks changed by 0.1% or more.

Instructions

In total: 9,220,978,239 → 9,222,147,518 (+0.01%).

Benchmark Base Head Change
packages/@rescript/runtime/Stdlib_Math.resi 21,359,617 21,409,301 +0.23%
packages/@rescript/runtime/Stdlib_List.resi 24,575,287 24,630,563 +0.22%
packages/@rescript/belt/src/Belt_Array.resi 33,748,619 33,816,570 +0.20%
packages/@rescript/runtime/Stdlib_Temporal_PlainDate.res 24,134,862 24,182,807 +0.20%
packages/@rescript/runtime/Stdlib_Temporal_PlainDateTime.res 25,584,927 25,633,919 +0.19%
parse/RedBlackTreeNoComments.res 14,509,792 14,536,600 +0.18%
parse/RedBlackTree.res 14,940,288 14,965,979 +0.17%
packages/@rescript/runtime/Stdlib_Temporal_ZonedDateTime.res 31,261,254 31,313,183 +0.17%
packages/@rescript/belt/src/Belt_List.resi 39,026,442 39,088,523 +0.16%
packages/@rescript/runtime/Stdlib_String.resi 29,508,481 29,554,485 +0.16%
5 more changes
Benchmark Base Head Change
packages/@rescript/runtime/Stdlib_Date.resi 34,336,943 34,388,801 +0.15%
packages/@rescript/runtime/Stdlib_TypedArray.res 41,365,158 41,412,465 +0.11%
packages/@rescript/runtime/Stdlib_Array.resi 40,170,193 40,213,450 +0.11%
format/RedBlackTreeNoComments.res 24,102,391 24,127,601 +0.10%
format/RedBlackTree.res 24,447,359 24,472,569 +0.10%

Output size

In total: 25,969,918 → 25,968,588 (-0.01%).

None of the 13 benchmarks changed by 0.1% or more.

Pull request dffeec9 compared with base 3d99a27 in this run.

@pkg-pr-new

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

Copy link
Copy Markdown

Open in StackBlitz

rescript

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

@rescript/belt

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

@rescript/darwin-arm64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: dffeec9

The type checker printed types and signatures through Oprint, four refs that
failed until Res_outcome_printer.setup filled them, and called the ReScript
pattern printer, the polymorphic variant printer and the polymorphic variant
match compiler through refs that Bs_conditional_initial set at startup. The
hooks existed because those modules sat in libraries above the type checker.
Now that typing links the printer library, they can be called directly:

- Res_outcome_printer moves from outcome_printer into typing, and Printtyp
  calls it. Oprint, Res_outcome_printer.setup and the outcome_printer
  library are gone.
- Parmatch calls Pattern_printer, Printtyp calls
  Res_printer.polyvar_ident_to_string, and Matching calls
  Polyvar_pattern_match. Matching's unused default implementations, its
  as_interval and Switch.test_sequence, which only they used, are removed.
- Ctype.variant_is_subtype is a function instead of a ref filled with
  Matching_polyfill.variant_is_subtype. Its body moves into Ctype, checking
  the base type with Ctype's own helpers, since Typeopt depends on Ctype;
  get_unboxed_type_representation moves up, unchanged, to precede it.
- Bs_conditional_initial keeps the hooks that can't be direct calls (the
  .cmi loader and the build file store, which tests replace) and moves into
  typing.

Output is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QchYQ7itFLVLUmZ368okjH
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt
cknitt force-pushed the layout-outcome-printer branch from 15d7218 to dffeec9 Compare November 22, 2026 07:49
@cknitt

cknitt commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: dffeec9b35

ℹ️ 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 22, 2026 09:31

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

changelog:skip No release notes needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant