Skip to content

Move the compiler-only dict and error helpers out of the AST library - #9360

Merged
cknitt merged 1 commit into
ast-payload-to-mlfrom
ast-compiler-only-helpers
Nov 21, 2026
Merged

cknitt merged 1 commit into
ast-payload-to-mlfrom
ast-compiler-only-helpers

Conversation

@cknitt

@cknitt cknitt commented Nov 20, 2026

Copy link
Copy Markdown
Member

Stacked on #9359. Moves code that only the compiler uses out of the AST library (compiler/ast), so the library no longer needs Primitive_modules.

  • The v0 PPX encoding of dict literals (Primitive_dict.make/spread calls with the res.dict* markers) moves from Ast_dict to a new compiler module, Ast_dict0, used by the v0 AST bridge. Ast_dict keeps the grouping of dict entries that the parser, printer and type checker use.
  • Ast_mapper.extension_of_error and Ast_raw.uninterpreted build compiler errors. They move to Builtin_attributes as extension_of_error and uninterpreted_extension, next to error_of_extension, which decodes such errors and now reuses the same message.

The AST library now reaches 9 ext modules, all through Location and Clflags.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QchYQ7itFLVLUmZ368okjH

@cknitt
cknitt added this pull request to stack #9361 November 20, 2026 21:22
@cknitt cknitt added the changelog:skip No release notes needed label Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Changelog

No changelog entry.

Semantic Diff

1 commit · Full page

Move the compiler-only dict and error helpers out of the AST library

36af448 · cknitt + Claude · Nov 20, 2026, 21:21 UTC

The AST library had code that only the compiler uses. The v0 PPX encoding of dict literals moves from Ast_dict to a new compiler module, Ast_dict0, so the AST library no longer needs Primitive_modules. Ast_mapper's extension_of_error and Ast_raw's uninterpreted error move to Builtin_attributes, next to error_of_extension, which decodes such errors.

@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.84211% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.19%. Comparing base (ec3592f) to head (36af448).

Files with missing lines Patch % Lines
compiler/ml/typecore.ml 0.00% 3 Missing ⚠️
compiler/ml/builtin_attributes.ml 88.88% 1 Missing ⚠️
compiler/ml/typemod.ml 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##           ast-payload-to-ml    #9360   +/-   ##
==================================================
  Coverage              82.19%   82.19%           
==================================================
  Files                    459      460    +1     
  Lines                  65739    65744    +5     
==================================================
+ Hits                   54031    54036    +5     
  Misses                 11708    11708           
Files with missing lines Coverage Δ
compiler/ast/ast_dict.ml 100.00% <ø> (ø)
compiler/ast/ast_mapper.ml 100.00% <ø> (+0.27%) ⬆️
compiler/ast/ast_raw.ml 94.28% <ø> (+2.61%) ⬆️
compiler/ml/ast_dict0.ml 100.00% <100.00%> (ø)
compiler/ml/ast_mapper_from0.ml 79.46% <100.00%> (ø)
compiler/ml/ast_mapper_to0.ml 80.36% <100.00%> (ø)
tests/ounit_tests/ounit_ast_mapper0_tests.ml 90.58% <100.00%> (+<0.01%) ⬆️
compiler/ml/builtin_attributes.ml 83.80% <88.88%> (+0.30%) ⬆️
compiler/ml/typemod.ml 77.10% <0.00%> (ø)
compiler/ml/typecore.ml 89.11% <0.00%> (-0.04%) ⬇️
🚀 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 20, 2026 •

Copy link
Copy Markdown

✅ Compiler benchmarks

Allocated words

In total: 636,535,682 → 636,535,399 (±0.00%).

Generated projects: 629,007,535 → 629,006,927 (±0.00%).

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

Instructions

In total: 9,224,520,504 → 9,222,857,528 (-0.02%).

Benchmark Base Head Change
packages/@rescript/runtime/Stdlib_Math.resi 21,505,322 21,436,018 -0.32%
packages/@rescript/runtime/Stdlib_Temporal_PlainDate.res 24,290,713 24,221,823 -0.28%
packages/@rescript/runtime/Stdlib_List.resi 24,726,432 24,656,488 -0.28%
packages/@rescript/runtime/Stdlib_Temporal_PlainDateTime.res 25,731,090 25,662,393 -0.27%
parse/RedBlackTreeNoComments.res 14,599,664 14,564,872 -0.24%
parse/RedBlackTree.res 15,004,282 14,968,940 -0.24%
packages/@rescript/runtime/Stdlib_String.resi 29,662,304 29,594,702 -0.23%
packages/@rescript/runtime/Stdlib_Temporal_ZonedDateTime.res 31,414,135 31,344,186 -0.22%
packages/@rescript/belt/src/Belt_Array.resi 33,916,411 33,846,145 -0.21%
packages/@rescript/runtime/Stdlib_Date.resi 34,485,310 34,414,602 -0.21%
5 more changes
Benchmark Base Head Change
packages/@rescript/belt/src/Belt_List.resi 39,189,258 39,121,670 -0.17%
packages/@rescript/runtime/Stdlib_TypedArray.res 41,525,742 41,455,543 -0.17%
packages/@rescript/runtime/Stdlib_Array.resi 40,307,889 40,239,886 -0.17%
format/RedBlackTreeNoComments.res 24,177,457 24,142,863 -0.14%
format/RedBlackTree.res 24,522,490 24,487,896 -0.14%

Output size

In total: 25,969,643 → 25,969,547 (±0.00%).

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

Pull request 36af448 compared with base 4571994 in this run.

@pkg-pr-new

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

Copy link
Copy Markdown

Open in StackBlitz

rescript

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

@rescript/belt

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

@rescript/darwin-arm64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: 36af448

@cknitt

cknitt commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 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-21T07:55:05.292839Z 36af448 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. Can't wait for the next one!

Reviewed commit: 2bd0df906b

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

The AST library had code that only the compiler uses. The v0 PPX encoding
of dict literals moves from Ast_dict to a new compiler module, Ast_dict0, so
the AST library no longer needs Primitive_modules. Ast_mapper's
extension_of_error and Ast_raw's uninterpreted error move to
Builtin_attributes, next to error_of_extension, which decodes such errors.

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 ast-compiler-only-helpers branch from 2bd0df9 to 36af448 Compare November 21, 2026 07:26
@cknitt

cknitt commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 36af448df5

ℹ️ 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 21, 2026 07:56
@cknitt
cknitt merged commit 93f6e9d into master Nov 21, 2026
24 of 38 checks passed
@cknitt
cknitt deleted the ast-compiler-only-helpers branch November 21, 2026 10:16
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.

2 participants